I know that compilers are smart, but the API doesn't make things easier at all
I know that compilers are smart, but the API doesn't make things easier at all
In general having some higher level, well optimized helpers can certainly reduce verbosity and increase speed. That said, some types of verbosity just make the programmer write what the compiler would translate to anyway. Or can end up being unnecessary - e.g. a strongly typed language with no inference certain slows the programmer with no effect on the program (though maybe an effect on the type checker).
rep movsb
will do the trick. This assumes that the source register points to source, destination register points to destination and counter register is set to number of bytes to copy.- A verbose SIMD copy loop is often faster even on modern Intel CPUs that have the more modern rep implementation.
- A simple byte copy loop will beat both SIMD and rep when you're copying smaller amounts at a time.
SomeClass x = new SomeClass();
won't make anything slower (ignoring auto for now)
Now, I read Java code and I can't help but wonder how things are harder
For example, setters and getters, what would be a simple memory write becomes a function call. Not complaining when you actually need it.
Reading the examples here (and those are not too bad) https://developer.android.com/reference/java/net/HttpURLConn... it seems you have to actually fight the API to get anything done
Why do you need to cast the return of a url.openConnection() to a HttpURLConnection? (I mean, how many connection types exist?)
https://docs.oracle.com/en/java/javase/11/docs/api/java.net....
Two? https://developer.android.com/reference/java/net/URLConnecti...