|
|
|
|
|
by josephg
1265 days ago
|
|
Just because we’re on the topic of performance: the rust optimizer can sometimes generate better code if you use map / filter / etc. The slice iterator in any context is a huge win over manual array iteration because it only needs to do bounds checking once. Javascript (v8, last I checked) is the opposite. Simple for loops almost always outperform anything else. |
|
Most of the time you should just write whatever's clear/convenient but sometimes it's worth trying both and scrutinizing godbolt.