Skip to main content

News

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - Radnen

1
Hellos and Byes / Re: Happy 2019!
Hi FBNil! Long time no see! I hope you have a fantabulous 2019 too! :)
2
I'm still baffled the widespread popularity of lodash... when libraries you and I write can be an order of magnitude faster, and any missing convenience methods lodash has, can always be added.

Anyways, I didn't have from.js on me, but I ran your parameters on my new Linkier library along with lazy and Link and got:
Code: ('js') [Select]
const Linkier = require('./linkier.js');
const Link = require('./modules/link.js');
const Lazy = require('./modules/lazy.js');
const Benchmark = require('benchmark');

// Generate a random list of 100,000 integer between 0 and 1,000.
const items = [];
for (let i = 0; i < 100000; ++i) {
    items[i] = Math.floor(Math.random() * 1001);
}

const suite = new Benchmark.Suite;
const linkier = Linkier(items).filter(n => n % 2 === 0).take(10000).map(n => n + 1);
const link = Link(items).filter(n => n % 2 === 0).take(10000).map(n => n + 1);
const lazy = Lazy(items).filter(n => n % 2 === 0).take(10000).map(n => n + 1);

suite.add('Linkier', function() {
    linkier.reduce((a, n) => a + n, 0);
}).add('Link', function() {
    link.reduce((a, n) => a + n, 0);
}).add('Lazy', function() {
    lazy.reduce((a, n) => a + n, 0);
}).add('For Loop', function() {
    let n = 0;
    let r = 0;
    for (let i = 0; i < items.length; ++i) {
        if (items[i] % 2 === 0) {
            n++;
            if (n <= 10000) {
                const m = items[i] + 1;
                r = r + m;
            }
        }
    }
}).add('For Loop 2', function() {
    let n = 0;
    let r = 0;
    for (let i = 0; i < items.length; ++i) {
        if (items[i] % 2 === 0) {
            n++;
            if (n <= 10000) {
                const m = items[i] + 1;
                r = r + m;
            } else {
                break;
            }
        }
    }
}).on('cycle', (event) => {
    console.log(String(event.target));
}).on('complete', function() {
    console.log('Fastest is: ' + this.filter('fastest').map('name'));
}).run({ async: true });

Code: [Select]
Linkier x 4,242 ops/sec ±5.49% (78 runs sampled)
Link x 3,786 ops/sec ±2.13% (91 runs sampled)
Lazy x 2,917 ops/sec ±2.87% (91 runs sampled)
For Loop x 2,213 ops/sec ±2.01% (96 runs sampled)
For Loop 2 x 11,052 ops/sec ±1.52% (97 runs sampled)
Fastest is: For Loop 2

What we learn here, is that hand-writing a for loop can be slower... The first for loop doesn't short circuit after 10,000 items, but that's on intention. How many times in writing a for loop you think of doing that? Therefore from.js, link.js and other libraries are going to be faster since they can make those common-sense decisions for you, and just automatically make your code faster.
3
Spherical News / Re: Forum updates thread
I really like the theme going on. It's easy on the eyes and says "Sphere". Thanks!
4
Same with Fat Cerberus. I didn't know Ctrl+PageUp/PageDown was a thing! I just tried in Chrome and it worked. Guess you learn something new every day.

I do use Shift+Insert to paste all the time, however. On a nice full keyboard, at least, it feels nicer with just the right hand.
5
  • Dispatch.onExit: Run some code on shutdown, after the event loop terminates.  This works even if the user manually closes the window!

I like this. This prevented me from writing a clean MMO in Sphere back in the day. I had to 'poll' every user to see if they were actually logged in or not every like 5 minutes. Good times, hahaha,
6
Since QSI won't have a source editor, I'm going to work on a Visual Studio Code extension for miniSphere API completion/documentation and possibly for interfacing with SSj.

I like this Visual Studio Code idea!
7
Spherical News / Re: Forum updates thread
We apparently lost our favicon, too. I was looking at my bookmarks and couldn't immediately see the Spherical icon.
8
Engine Development / Re: miniSphere 5.1.0
I actually just fixed that with Surface.Screen. I installed the engine and editor with the installer and I indeed see 5.1.0 in the about config.

Anyways, I'm going to try and see what I can do with the new API. Things are much different. Better, but different so, I'll have to learn a few things.
9
Engine Development / Re: miniSphere 5.1.0
So, I download a fresh, clean copy of MiniSphere 5.1.0 and I run a new, default game in the editor and I get a reference error. It says 'screen' is not defined.

I'm thinking of maybe creating games again, hahaha. I have a Raspberry Pi and I'd love to see if maybe it's possible to have Sphere games run on it someday.
10
Engine Development / Re: miniSphere 5.1.0
Merry Christmas! What you've done with Sphere in the last year is truly astonishing! Great work!!
11
Haha! I vote this Sphere GOTY 2017. :)
12
Engine Development / Re: miniSphere 5.0.0
Great work!! I'll definitely check this out when I get home!
13
Engine Development / Re: miniSphere 5.0rc
Release is still on track for the 31st so get ready, the best miniSphere release yet is almost here!  8)

Nice! Can't wait. :)
14
Projects / Re: Project ZeC (My Zelda-esque Clone)
That is a better explaination than the wiki. Although, not a fan of a "death" example. I've been trying to figure this out for a little while now. Based on that, any item stored in a map that the player collected would be part of 'world' so the variable can be stored in a save file?

Yes, this is a perfect example of storing things in a save file. :)
15
Projects / Re: Project ZeC (My Zelda-esque Clone)
Self: The current entity running the script. This applies to scripts that belong to people.

Map: This is the map scope. Writing data into this object is accessible by all entities and methods on that map.

World: This is the world scope. Writing data into this object makes it available to all maps and people. This is great to store quest variables and world reactions. A death of a person on map A  can be talked about on map C by writing the variables to that object.