This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import time | |
| import threading | |
| import multiprocessing | |
| from numba import jit | |
| import numpy as np | |
| thing1 = np.empty((4000, 4000)) | |
| thing2 = np.empty((4000, 4000)) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdlib.h> | |
| #include <stdio.h> | |
| #include <math.h> | |
| typedef struct { | |
| double x, y, z; | |
| } Point; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use std::io::BufRead; | |
| fn main() { | |
| let file = std::fs::File::open("resources/solarccf.txt").unwrap(); | |
| let buf = std::io::BufReader::new(file); | |
| let (rv_iter, quiet_iter, active_iter) = buf | |
| .lines() | |
| .skip(2) | |
| .map(|l| l.unwrap().split_whitespace()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| extern crate rand; // from cargo, not the experimental one | |
| use rand::distributions::IndependentSample; | |
| pub struct ParticleVector { | |
| data: Vec<f64>, | |
| size: usize, | |
| } | |
| #[repr(C)] | |
| struct Point { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <math.h> | |
| typedef struct Point { | |
| double x; | |
| double y; | |
| double z; | |
| } Point; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ----------------------------------ASSEMBLY nrt---------------------------------- | |
| .text | |
| .file "<string>" | |
| .globl nrt_atomic_add | |
| .p2align 4, 0x90 | |
| .type nrt_atomic_add,@function | |
| nrt_atomic_add: | |
| movl $1, %eax | |
| lock xaddq %rax, (%rdi) | |
| addq $1, %rax |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ----------------------------------ASSEMBLY nrt---------------------------------- | |
| .text | |
| .file "<string>" | |
| .globl nrt_atomic_add | |
| .p2align 4, 0x90 | |
| .type nrt_atomic_add,@function | |
| nrt_atomic_add: | |
| movl $1, %eax | |
| lock xaddq %rax, (%rdi) | |
| addq $1, %rax |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Point: | |
| x, y, z f64 | |
| Particle: | |
| position, velocity, acceleration Point | |
| mass f64 | |
| particles = SoA(Particle, 100) | |
| particles.position = random(0.03, 0.03) | |
| particles.mass = 1e-6 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| warning: use of `unwrap_or` followed by a function call | |
| --> src/commands/ls.rs:30:33 | |
| | | |
| 30 | let dir = Path::new(options.value_of_os("directory").unwrap_or(state.directory.as_os_str())); | |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `options.value_of_os("directory").unwrap_or_else(|| state.directory.as_os_str())` | |
| | | |
| = note: #[warn(or_fun_call)] on by default | |
| = help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#or_fun_call |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| struct CircularBuffer<T> { | |
| buffer: Vec<T>, | |
| head: usize, | |
| tail: usize, | |
| } | |
| impl <T: Default> CircularBuffer<T>{ | |
| pub fn new(size: usize) -> Self { | |
| CircularBuffer { | |
| buffer: vec![Default::default(); size], |
OlderNewer