1. Куча / Говнокод #27632

    +1

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    https://benchmarksgame-team.pages.debian.net/benchmarksgame/performance/pidigits.html
    
    1.0 	C gcc #6	0.59 	2,444 	1090 	2.37 	100% 100% 100% 98%
    1.1 	C++ g++ #6	0.66 	5,152 	986 	2.63 	100% 100% 100% 100%
    1.2 	Rust #4	 	0.71 	2,672 	799 	0.73 	3% 0% 0% 100% 
    1.2 	Free Pascal #3	0.73 	2,268 	530 	0.73 	0% 0% 100% 0%
    1.4 	F# .NET #6	0.82 	34,428 	905 	0.83 	1% 2% 96% 1%
    1.4 	Haskell GHC #5	0.83 	6,056 	928 	0.84 	0% 99% 1% 1%
    1.5 	Ada 2012 GNAT   0.88 	4,704 	1130 	0.89 	0% 0% 100% 1%
    1.5 	Rust #2	 	0.88 	2,800 	1306 	0.89 	0% 1% 100% 0%
    1.5 	C++ g++ #4	0.89 	4,280 	513 	0.92 	0% 2% 1% 100%
    1.5 	OCaml #7	0.89 	5,968 	593 	0.90 	0% 0% 1% 100%
    1.5 	Swift #2	0.89 	9,256 	600 	0.91 	3% 0% 0% 99%
    1.5 	PHP #5	  	0.91 	13,196 	399 	0.96 	2% 0% 3% 100%
    1.5 	C# .NET #5	0.92 	35,404 	977 	0.96 	98% 3% 2% 1%
    1.6 	Java  #3	0.93 	36,552 	764 	0.98 	2% 3% 1% 99%

    However, Java is one of the fastest and most energy-efficient object-oriented language. Interpreted languages like Perl, Python, and Ruby were among the least energy efficient

    Using the Computer Benchmarks Game, the team of researchers tested these languages by compiling/executing such programs using the state-of-the-art compilers, virtual machines, interpreters, and libraries.

    They then analyzed the performance of the different implementation considering three variables: execution time, memory consumption and energy consumption.

    https://jaxenter.com/energy-efficient-programming-languages-137264.html

    https://jaxenter.com/wp-content/uploads/2017/09/energy-efficient-languages-768x689.png

    https://jaxenter.com/wp-content/uploads/2017/09/energy-efficient-languages-2-768x368.png

    3.14159265, 31 Августа 2021

    Комментарии (43)
  2. Куча / Говнокод #27627

    +1

    1. 1
    Тестовый Оффтоп #4

    #1: https://govnokod.ru/26373 https://govnokod.xyz/_26373
    #1: https://govnokod.ru/26611 https://govnokod.xyz/_26611
    #1: https://govnokod.ru/26824 https://govnokod.xyz/_26824
    #1: https://govnokod.ru/26850 https://govnokod.xyz/_26850
    #2: https://govnokod.ru/27102 https://govnokod.xyz/_27102
    #3: https://govnokod.ru/27523 https://govnokod.xyz/_27523

    IIIyqpymuHckuu_nemyx, 29 Августа 2021

    Комментарии (1263)
  3. Куча / Говнокод #27625

    0

    1. 1
    Бесконечный оффтоп имени Борманда #5

    #1: https://govnokod.ru/25864 https://govnokod.xyz/_25864
    #2: https://govnokod.ru/25921 https://govnokod.xyz/_25921
    #3: https://govnokod.ru/26544 https://govnokod.xyz/_26544
    #4: https://govnokod.ru/26838 https://govnokod.xyz/_26838

    nepeKamHblu_nemyx, 29 Августа 2021

    Комментарии (734)
  4. Куча / Говнокод #27622

    0

    1. 1
    Электрика / электроника #4

    #1: https://govnokod.ru/25437 https://govnokod.xyz/_25437
    #2: https://govnokod.ru/25820 https://govnokod.xyz/_25820
    #3: https://govnokod.ru/26570 https://govnokod.xyz/_26570

    nepeKamHblu_nemyx, 27 Августа 2021

    Комментарии (569)
  5. Куча / Говнокод #27620

    +1

    1. 1
    Питушня #19

    #1: https://govnokod.ru/26692 https://govnokod.xyz/_26692
    #2: https://govnokod.ru/26891 https://govnokod.xyz/_26891
    #3: https://govnokod.ru/26893 https://govnokod.xyz/_26893
    #4: https://govnokod.ru/26935 https://govnokod.xyz/_26935
    #5: (vanished) https://govnokod.xyz/_26954
    #6: (vanished) https://govnokod.xyz/_26956
    #7: https://govnokod.ru/26964 https://govnokod.xyz/_26964
    #8: https://govnokod.ru/26966 https://govnokod.xyz/_26966
    #9: https://govnokod.ru/27017 https://govnokod.xyz/_27017
    #10: https://govnokod.ru/27045 https://govnokod.xyz/_27045
    #11: https://govnokod.ru/27058 https://govnokod.xyz/_27058
    #12: https://govnokod.ru/27182 https://govnokod.xyz/_27182
    #13: https://govnokod.ru/27260 https://govnokod.xyz/_27260
    #14: https://govnokod.ru/27343 https://govnokod.xyz/_27343
    #15: https://govnokod.ru/27353 https://govnokod.xyz/_27353
    #16: https://govnokod.ru/27384 https://govnokod.xyz/_27384
    #17: https://govnokod.ru/27482 https://govnokod.xyz/_27482
    #18: https://govnokod.ru/27514 https://govnokod.xyz/_27514

    nepeKamHblu_nemyx, 27 Августа 2021

    Комментарии (637)
  6. Куча / Говнокод #27618

    +3

    1. 1
    Афганистан заебал.

    rotoeb, 26 Августа 2021

    Комментарии (4)
  7. Куча / Говнокод #27605

    +6

    1. 1
    Раскрытие покровов. Настя, облачные технологии и Настенька.

    HACTEHbKA, 22 Августа 2021

    Комментарии (295)
  8. Куча / Говнокод #27601

    +1

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    fn main() {
        println!("Hello World!");
    }
    
    rustc --version --verbose:
    
    rustc 1.52.1 (9bc8c42bb 2021-05-09)
    binary: rustc
    commit-hash: 9bc8c42bb2f19e745a63f3445f1ac248fb015e53
    commit-date: 2021-05-09
    host: powerpc-unknown-linux-gnu
    release: 1.52.1
    LLVM version: 12.0.0
    
    Error output
    
    rustc ./hello.rs
    Illegal instruction (core dumped)

    https://github.com/rust-lang/rust/issues/85238

    Open: clienthax opened this issue on May 12 · 6 comments

    3.14159265, 22 Августа 2021

    Комментарии (26)
  9. Куча / Говнокод #27576

    +5

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    // And then I replaced the idiomatic Rust code for working with block like
    
        for (dline, (sline0, sline1)) in dst.chunks_mut(dstride).zip(tmp.chunks(TMP_BUF_STRIDE).zip(tmp2.chunks(TMP_BUF_STRIDE))).take(h) {
            for (pix, (&a, &b)) in dline.iter_mut().zip(sline0.iter().zip(sline1.iter())).take(w) {
                *pix = ((u16::from(a) + u16::from(b) + 1) >> 1) as u8;
            }
        }
    
    // with raw pointers:
    
        unsafe {
            let mut src1 = tmp.as_ptr();
            let mut src2 = tmp2.as_ptr();
            let mut dst = dst.as_mut_ptr();
            for _ in 0..h {
                for x in 0..w {
                    let a = *src1.add(x);
                    let b = *src2.add(x);
                    *dst.add(x) = ((u16::from(a) + u16::from(b) + 1) >> 1) as u8;
                }
                dst = dst.add(dstride);
                src1 = src1.add(TMP_BUF_STRIDE);
                src2 = src2.add(TMP_BUF_STRIDE);
            }
        }

    What do you know, the total decoding time for the test clip I used shrank from 6.6 seconds to 4.9 seconds. That’s just three quarters of the original time!

    And here is the problem. In theory if Rust compiler knew that the input satisfies certain parameters i.e. that there’s always enough data
    to perform full block operation in this case, it would be able to optimise code as good as the one I wrote using pointers or even better.
    But unfortunately there is no way to tell the compiler that input slices are large enough to perform the operation required amount of times.
    Even if I added mathematically correct check in the beginning it would not eliminate most of the checks.

    https://codecs.multimedia.cx/2021/05/missing-optimisation-opportunity-in-rust/

    3.14159265, 17 Августа 2021

    Комментарии (125)
  10. Куча / Говнокод #27571

    0

    1. 1
    2. 2
    3. 3
    Автомобиль-русофоб
    
    https://habr.com/ru/post/572984/

    Я нашел статью про Насру (formerly Gologub).

    JloJle4Ka, 15 Августа 2021

    Комментарии (1)