1
Show Posts
This section allows you to view all Show Posts made by this member. Note that you can only see Show Posts made in areas you currently have access to.
Messages - Radnen
2
Engine Development / Re: Oozaru: Sphere for the Web
3
Engine Development / Re: miniSphere 5.5.0
4
Off-Topic Discussions / Re: Happy new year everyone!
5
Hellos and Byes / Re: My return
6
Libraries / Re: EventEmitter for miniSphere
7
Engine Development / Re: Tileset won't update...
8
Programming / Re: So I wrote a monad tutorial...
That's indeed the simplest explanation yet. I was looking for a simple overview, like an "all-together", and what you just wrote, is it.
9
Programming / Re: So I wrote a monad tutorial...
I'd say I understand Monads a bit better from an imperative context, but I also think your tutorial isn't necessarily the easiest to understand. I think if one has a lot of programming experience, one can follow along, but at the very end of the day monads are complex, and must take a complex chain of thought to understand. And, if anything, actually making a monad and playing around with them interactively is the best way to learn.
But as for me, I will definitely say I came out learning a lot more about them. So, I do think it's effective for more seasoned programmers, Does it break the curse? I dunno, but I'm sure you'll find out someday!
10
Projects / Re: Project Infineon - An unorthodox procedurally generated Dungeon Crawler.
11
Hellos and Byes / Re: Happy 2019!
12
Engine Development / Re: miniSphere 5.3b1 (stable: 5.2.13)
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.
13
Spherical News / Re: Forum updates thread
14
Editor Development / Re: QtSphere IDE (working title) 0.2.3
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.
15
Engine Development / Re: miniSphere 5.2b1 (stable 5.1.3)
- 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,