Grew up in Russia, lived in the States, moved to Germany, sometimes live in Spain. I program since I was 13. I used to program games, maps and now I reverse engineer password managers and other stuff
Location
Berlin and Málaga
Education
MS in CS from State Polytechnic University of St. Petersburg
The code is mentioned in the bottom of the post: gist.github.com/detunized/17f524d7...
The graphs I draw using Google Sheets. I can add this code later to my set. I actually looked for reverse on Buffet but didn't see it. Weird.
Just plugging a buffer into your Fast is twice faster on long strings, same and maybe a little worse on short:
functionfindLongestWordLengthBufferFast(str){constbuf=Buffer.from(str,'ascii')letl=buf.length;letmaxLength=0;letcurrentLength=0;for(leti=0;i<l;++i){if(buf[i]===32){if(currentLength>maxLength){maxLength=currentLength;}currentLength=0;}else{++currentLength;}}// Account for the last wordreturncurrentLength>maxLength?currentLength:maxLength;}
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
The code is mentioned in the bottom of the post: gist.github.com/detunized/17f524d7...
The graphs I draw using Google Sheets. I can add this code later to my set. I actually looked for reverse on Buffet but didn't see it. Weird.
Yeah, it's not listed on the Node docs, because it's inherited.
It's on MDN though.
This is over twice as fast :D
This was 💩 though:
Just plugging a buffer into your
Fast
is twice faster on long strings, same and maybe a little worse on short: