This repository has been archived by the owner on Jul 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 24
/ports/node *.detectSync() fails too often / returns different results than *.detect() #25
Comments
I paired to test code down to just sync/async and I don't see the same issue in my build:
What OS are you running on? Let me know and I'll try to setup a VM and replicate the issue. |
Ok, maybe it's more about memory or sth. Here's the same test but with a fixed string length.
//
// ...
//
console.log('#Chars | V1 | V2 | V3 ');
console.log('------- | --- | --- | ---');
var str = str_repeat('Alle meine Entchen schwimmen auf dem See, den Kopf dann in das Wasser und blub. ',100);
for(var i=1, i_max=100; i <= i_max; ++i)
{
ASYNC.parallel(
{
v1: function(cb){ detect_v1(str,cb); },
v2: function(cb){ detect_v2(str,cb); },
v3: function(cb){ detect_v3(str,cb); }
},
function(err,res)
{
console.log(str.length+' | '+res.v1+' | '+res.v2+' | '+res.v3);
});
} Debian 3.2.0-2-686-pae and should be a weird squeeze version after all. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
To be honest, I don't use *.detectSync() at the moment, because i don't understand the parameter
skipWeakMatches
in detail. But it's elegant (requires us like 1 line of code) and darn fast (50% faster than *.detect() in some cases). So it might be cool to invest a little more devtime into this function.During my tests i noted that *.detectSync() behaves completely different than *.detect(), i.e. it fails a lot more often. Looks like this isn't a problem with specialchars or sth., but most likely with the string length.
The following table compares the output of
Chars | V1 | V2 | V3
------- | --- | --- | ---
80 | de | de | de
160 | de | de | de
240 | de | de | de
320 | de | de | de
400 | de | false | de
480 | de | false | de
560 | de | false | de
640 | de | false | de
720 | de | de | de
800 | de | false | de
880 | de | false | de
960 | de | false | de
1040 | de | false | de
1120 | de | false | de
1200 | de | false | de
1280 | de | false | de
1360 | de | false | de
1440 | de | de | de
1520 | de | de | de
1600 | de | de | de
1680 | de | de | de
1760 | de | de | de
1840 | de | de | de
1920 | de | de | de
2000 | de | de | de
2080 | de | de | de
2160 | de | de | de
2240 | de | de | de
2320 | de | de | de
2400 | de | de | de
2480 | de | de | de
2560 | de | de | de
2640 | de | de | de
2720 | de | de | de
2800 | de | de | de
2880 | de | de | de
2960 | de | de | de
3040 | de | de | de
Aaaand some hacky code:
The text was updated successfully, but these errors were encountered: