Showing posts with label Programming. Show all posts
Showing posts with label Programming. Show all posts

20180824

p5.js vs processing.js

Explanation of the difference between p5.js and processing.js here and here and here

The history of Processing here

20180710

BlackScript

Valuable technique in JavaScript class coding: link

The following benchmarks indicate a performance improvement for bulk object creation.
Try this in your own browser here

Update 20230119: Ex Nihilo wins in jsbench.me tests on Chrome 109 and Firefox 109:

Chrome 109

Firefox 109



Older benchmarks follow for archival reference:

A benchmark.js test running on node.js:
________________________________________________________
Research>node --version
v10.16.3

Research>node bench.js
OldStyleClass x 165,772 ops/sec ±0.38% (106 runs sampled)
Ex Nihilo x 180,305 ops/sec ±0.50% (104 runs sampled)
Fastest is Ex Nihilo

Research>node bench.js
NewStyleClass x 163,242 ops/sec ±0.28% (111 runs sampled)
Ex Nihilo x 180,219 ops/sec ±0.46% (100 runs sampled)
Fastest is Ex Nihilo

Research>node bench.js
OldStyleClass x 160,930 ops/sec ±0.58% (103 runs sampled)
NewStyleClass x 161,634 ops/sec ±0.79% (105 runs sampled)
Ex Nihilo x 176,387 ops/sec ±0.44% (107 runs sampled)
Fastest is Ex Nihilo

Older runs on jsperf.com:




Update 20200627: None of the newer versions of the browsers run Ex Nihilo faster. Optimization wins!

Update 20201006: Additional server-side tests:
________________________________________________________
Research>node --version
v12.19.0

Research>node bench.js
OldStyleClass x 153,207 ops/sec ±0.95% (84 runs sampled)
NewStyleClass x 150,535 ops/sec ±0.32% (93 runs sampled)
Ex Nihilo x 166,850 ops/sec ±1.84% (91 runs sampled)
Fastest is Ex Nihilo

________________________________________________________
Research>node --version
v13.14.0

Research>node bench.js
OldStyleClass x 151,339 ops/sec ±0.76% (86 runs sampled)
NewStyleClass x 147,369 ops/sec ±0.27% (95 runs sampled)
Ex Nihilo x 164,624 ops/sec ±0.26% (93 runs sampled)
Fastest is Ex Nihilo

________________________________________________________
Research>node --version
v14.13.0

Research>node bench.js
OldStyleClass x 147,954 ops/sec ±1.03% (87 runs sampled)
NewStyleClass x 144,716 ops/sec ±0.37% (93 runs sampled)
Ex Nihilo x 160,388 ops/sec ±0.47% (89 runs sampled)
Fastest is Ex Nihilo

20161107

Faster hypot for JavaScript

When the distance between two points is required, one method of computation in modern browsers is a function called Hypot. Implementation of this function is often not optimized and ultimately calls on Math.sqrt at the last step. Performance tests indicate a calculation bottleneck with JavaScript's standard Math library implementation. Here then is an improvement of hypot at the cost of a fractional error (0.05%):

  function hypot(x, y) { // expects: abs(x) and abs(y)
    var a = Math.max(x,y),
        b = Math.min(x,y)/a,
        c = 1 + b*b;
    return a * ((-0.0705613450914645*c + 0.624084374908536)*c + 0.447383574908535);
  }

Note, this function expects absolute values (which can be computed on the call). The formula in the return is a polynomial approximation of the square root of values in the range from 1 to 2. Caveat: your mileage may vary!

20150119

HP-16C

The newest addition to the computing family here at the studio is a museum-quality specimen of the Hewlett Packard 16C Computer Scientist acquired through eBay.














Take a look at this great article titled "Long Live the HP-16C" by Valentin Albillo here.
Love this device! Of course, the HP Museum site has useful information about this and many other HP calculators. If seeking the missing manual, there is a scanned version here.

Also, Cameron Paine has a faithful simulation running on the Windows OS here. (Select the menu item View...Classic for the nostalgic visual replica.) Another version for the browser is meh.

Update 20150227:
One Voyager was not enough! We added a near-flawless HP-11C.

Additional internal data

20130603

Objective-C and Code::Blocks

Tricky to get this combination operational. The wiki entry is helpful for configuration. Not finding any of the Objective-C libraries in the default installation, we located what might be the correct support files on the TDM site. But after adding these matched libraries, we ended up with compiler warnings and a segmentation fault during the first alloc, using the simple test code on the wiki page. Next thing to try was the troubleshooting suggestion of removing libobjc.dll.a ... but that resulted in a laundry list of "undefined reference to" ... precisely the message the wiki entry claims the removal will avoid!

Finally, what worked was removing the entire mingw installation from the CodeBlocks directory (just delete everything in the mingw directory, version 4.7.1) and install mingw using the installer referenced on the mingw website. During installation, set the install directory to the mingw directory under CodeBlocks and then select to install the C, C++, and Objective-C compilers. This resulted in a good installation of GCC 4.6.2, a warning-free compile, and a faultless run...yay!!! (Remember, you cannot do any Apple development with this configuration, so including foundation.h is not allowed. But you can learn and play with the fundamentals of the Objective-C language on the Windows platform in preparation for moving to a Mac for iOS or OSX app development.)

KVR News:

The Gadget Blog | Latest Gadgets, Technology