Hacker News new | past | comments | ask | show | jobs | submit login

> the technologies I use don't have those paradigms.

Your language most certainly has a syntax for bitwise operators. If you want to optimize (speed up) your code, knowledge like that would help you.

Node/Javascript: https://developer.mozilla.org/en/docs/Web/JavaScript/Referen...

PHP: http://php.net/manual/en/language.operators.bitwise.php

Python: https://wiki.python.org/moin/BitwiseOperators

Ruby: http://calleerlandsson.com/2014/02/06/rubys-bitwise-operator...

Visual Basic: http://msdn.microsoft.com/en-us/library/wz3k228a.aspx

A linked list is a kind of (abstract) data structure (http://en.wikipedia.org/wiki/Linked_list). If you come in touch with a static typed language (C, C++, C#, Java) such knowledge is essential. In languages like JavaScript and PHP you usually just use an object or an array. You can think of an linked list as an array of objects.




Most of the optimizing I do has to do with DOM manipulation and replacing slow generic library functions with native and/or custom-written ones. I've got a lot of low-hanging fruit to pick before I get to things like bitwise operators. Most optimizations I've seen are very language-specific and it can be hard to guess what is faster. Which is why profiling and a tool like http://jsperf.com/ are critical.

By the way, from what I've read bitwise operators aren't very efficient in JavaScript because of the overhead of conversion from generic duck-typing to binary.


You probably already know this, but your last sentence also has one minor advantage, in that you can use an otherwise pointless bitwise operation to strip off decimals, e.g. 100.919 | 0 .. => 100


I actually fond the most efficient solution to a problem recently (generating massive numbers of DNA sequence combinations, and checking for the number of mismatches between them) came from using MySQL and bitwsie operators. I tried Python, it was at least an order of magnitude slower. I tried Java, but that ran out of memory surprisingly quickly. I might try it in C at some stage but that will involve a fair bit more time.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: