Skip to content

Instantly share code, notes, and snippets.

@kriszyp
Last active January 2, 2021 15:16
Show Gist options
  • Save kriszyp/12f1598b3be35ba4d2d7ce0276bd5535 to your computer and use it in GitHub Desktop.
Save kriszyp/12f1598b3be35ba4d2d7ce0276bd5535 to your computer and use it in GitHub Desktop.
String functions
Function Characters Time
Buffer.toString 3 180ns
Buffer.toString 10 200ns
Buffer.toString 2000 500ns
Buffer.toString('latin1') 2000 415ns
TextDecoder.decode 10 1700ns
String.fromCharCode(...) 3 16ns
String.fromCharCode(...) 10 46ns
String.fromCharCode(...) 2000 4300ns
String.fromCharCode.apply(array) 3 29ns
String.fromCharCode.apply(array) 10 70ns
String.fromCharCode.apply(array) 2000 4800ns
String.fromCharCode.apply(buffer) 10 160ns
String.slice any 3ns
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment