1,029 karma · joined January 14, 2023
Obviously something used by millions of people will use a proportionate amount of energy. Not sure why that's so surprising to people.
[1]: https://phys.org/news/2015-12-christmas-energy-entire-countr...
- a keysym (the letter Z, wherever it happens to be in your current layout)
- or a keycode/scancode (the physical button under your pinky, no matter the current layout)
I use both methods for different bindings. For example I've bound the vim keys (hjkl) by scancode, and the layout keys ("S"tack, "F"ullscreen, "R"esize, etc) by symbol.
Gio UI is an immediate-mode UI, and immediate-mode UIs map very nicely to Rust. egui is quite expressive and easy to use. https://www.egui.rs/
If you had pointed at something like GTK, then yes, there is a big impedance mismatch there.
Maybe I'm a beginner then. He lists a few cases where it's not worse than sticking to 8-bit bools, but no cases where it's actually an improvement. It still wastes memory sometimes, e.g. if you have adjacent booleans in a struct, or boolean variables in a function that spill out of registers onto the stack. Sure it's only a few bytes here and there, but why pessimize? What do you gain from using a larger size?
But if it's not powered by AI it won't make the news in 2023
> For example, illegal transactions, scams and gambling together make up less than 3% of volume.
Either way this 0.12%-3% range doesn't begin to approach the ~6%-12% estimated illegal volume for USD.[2]
[1]: https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3942181
[2]: https://www.investopedia.com/articles/markets/032916/how-big...
The Pixel 6 is 6.4"
The Pixel 7 is 6.3"
The Pixel 8 is 6.2"
If the trend continues we only have to wait 3 more years for a < 6" phone
https://www.gsmarena.com/google_pixel_6-pictures-11037.php
If you've already decided what you think of a company and you're telling google as much, the reviews won't change your mind so they aren't a relevant result.
Tested with:
https://google.com/search?q=iphone+15
Getting started was literally as easy as:
pacman -S ollama
ollama serve
ollama run llama2:13b 'insert prompt'
You guys are doing the lord's work here- is half the number of vecs of the author's final solution (6 vs 3)
- wastes no bytes for padding (unless needed for alignment)
- lets you iterate in a cache-friendly way since the data is laid out in order in memory regardless of type
- even lets you access items by index in O(1)
Generally it has the same performance characteristics as a Vec<T>, but for heterogeneous data.
fn buildMap(allocator: std.mem.Allocator) !std.AutoHashMap(u64, u64) {
var result = std.AutoHashMap(u64, u64).init(allocator);
errdefer result.deinit();
try result.put(10, 100);
try result.put(20, 200);
return result;
}
Your #1 option should be possible once Zig has comptime allocators -- it's on the roadmap, but not possible yet iirc.Yes, if all operands are comptime-known (or comptime-length-known), bounds checks happen eagerly at compile time.
> Could I use variables as the indices and, if so, could I get a seg fault at runtime or are there some sort of guards on there?
Yes you can use variables. If they're out of range, behavior depends on the build mode:
- In Debug and ReleaseSafe, you get a guaranteed panic (which aborts the app with a stack trace)
- In ReleaseSmall and ReleaseFast, you get undefined behavior
On their discord I suggested a version of slicing that bounds checks in all modes (something like `slice?[1..5]`, syntax doesn't matter) and returns an optional slice, which is null if the bounds are out of range. But they didn't seem too keen on it. So I've been using a little wrapper function instead.