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

    +6

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

    HACTEHbKA, 22 Августа 2021

    Комментарии (193)
  2. Куча / Говнокод #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)
  3. Куча / Говнокод #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)
  4. Куча / Говнокод #27571

    0

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

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

    JloJle4Ka, 15 Августа 2021

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

    +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
    C	5.2s 	gcc test.c
    C++	1m 25s 	g++ test.cpp
    Zig	10.1s 	zig build-exe test.zig
    Nim	45s 	nim c test.nim
    Rust	Stopped after 30 minutes	rustc test.rs
    Swift	Stopped after 30 minutes 	swiftc test.swift
    D	Segfault after 6 minutes 	dmd test.d
    
    Rust and Swift took too long to compile 400k lines, so I tried smaller numbers: 
    
    # lines	Rust	Swift 	D
    2k	3.4s 	0.8s
    4k	9.0s 	1.0s
    8k	30.8s 	2.3s
    20k	3m 52s 	11.8s 	4.7s
    100k	- 	5m 57s 	segfault

    https://vlang.io/compilation_speed

    3.14159265, 15 Августа 2021

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

    +1

    1. 1
    2. 2
    3. 3
    4. 4
    10 лет назад читала самоучитель по Паскалю, где были задания: "написать алгоритм для нахождения простых чисел до n", 
    "написать 2D-пушку (на CRT модуле)". 
    Сейчас хочется найти его, вспомнить свое детство (задолго до того, как пошла формошлепить хех). 
    Ничего похожего пока не нашла.

    JaneBurt, 06 Августа 2021

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

    +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
    19. 19
    20. 20
    21. 21
    Ltac destruct_mint_ H := 
       match type of H with
          (MInt_ _ ?z ?t) =>
          lazymatch goal with
            |- ?GOAL =>
            refine (match H in (MInt_ _ z0 t0) return (z = z0 -> t = t0 -> GOAL) with
                    | mint_nil    _  =>
                      fun Heq_z Heq_tt_ =>
                        ltac:(destruct_mint_common Heq_tt_ Heq_z H)
                    | mint_cons   _ te rest l      r   t H =>
                      fun Heq_z Heq_tt_ =>
                        ltac:(destruct_mint_common Heq_tt_ Heq_z H)
                    | mint_cons_l _ te rest l r z t Hz H  =>
                      fun Heq_z Heq_tt_ =>
                        ltac:(destruct_mint_common Heq_tt_ Heq_z H)
                    | mint_cons_r _ te te' rest l r z t Hz Hcomm H =>
                      fun Heq_z Heq_tt_ =>
                        ltac:(destruct_mint_common Heq_tt_ Heq_z H)
                    end (eq_refl z) (eq_refl t))
          end
        end.

    Наебавшись с inversion в механизированным доказательстве, закрыл я очи.

    CHayT, 04 Августа 2021

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

    0

    1. 1
    Пиздец-оффтоп #26

    #1: https://govnokod.ru/26503 https://govnokod.xyz/_26503
    #2: https://govnokod.ru/26541 https://govnokod.xyz/_26541
    #3: https://govnokod.ru/26583 https://govnokod.xyz/_26583
    #4: https://govnokod.ru/26689 https://govnokod.xyz/_26689
    #5: https://govnokod.ru/26784 https://govnokod.xyz/_26784
    #5: https://govnokod.ru/26839 https://govnokod.xyz/_26839
    #6: https://govnokod.ru/26986 https://govnokod.xyz/_26986
    #7: https://govnokod.ru/27007 https://govnokod.xyz/_27007
    #8: https://govnokod.ru/27023 https://govnokod.xyz/_27023
    #9: https://govnokod.ru/27098 https://govnokod.xyz/_27098
    #10: https://govnokod.ru/27125 https://govnokod.xyz/_27125
    #11: https://govnokod.ru/27129 https://govnokod.xyz/_27129
    #12: https://govnokod.ru/27184 https://govnokod.xyz/_27184
    #13: https://govnokod.ru/27286 https://govnokod.xyz/_27286
    #14: https://govnokod.ru/27298 https://govnokod.xyz/_27298
    #15: https://govnokod.ru/27322 https://govnokod.xyz/_27322
    #16: https://govnokod.ru/27328 https://govnokod.xyz/_27328
    #17: https://govnokod.ru/27346 https://govnokod.xyz/_27346
    #18: https://govnokod.ru/27374 https://govnokod.xyz/_27374
    #19: https://govnokod.ru/27468 https://govnokod.xyz/_27468
    #20: https://govnokod.ru/27469 https://govnokod.xyz/_27469
    #21: https://govnokod.ru/27479 https://govnokod.xyz/_27479
    #22: https://govnokod.ru/27485 https://govnokod.xyz/_27485
    #23: https://govnokod.ru/27493 https://govnokod.xyz/_27493
    #24: https://govnokod.ru/27501 https://govnokod.xyz/_27501
    #25: https://govnokod.ru/27521 https://govnokod.xyz/_27521

    nepeKamHblu_nemyx, 02 Августа 2021

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

    0

    1. 1
    IT Оффтоп #105

    #75: https://govnokod.ru/27166 https://govnokod.xyz/_27166
    #76: https://govnokod.ru/27168 https://govnokod.xyz/_27168
    #77: https://govnokod.ru/27186 https://govnokod.xyz/_27186
    #78: https://govnokod.ru/27219 https://govnokod.xyz/_27219
    #79: https://govnokod.ru/27254 https://govnokod.xyz/_27254
    #80: https://govnokod.ru/27270 https://govnokod.xyz/_27270
    #81: https://govnokod.ru/27280 https://govnokod.xyz/_27280
    #82: https://govnokod.ru/27284 https://govnokod.xyz/_27284
    #83: https://govnokod.ru/27296 https://govnokod.xyz/_27296
    #84: https://govnokod.ru/27336 https://govnokod.xyz/_27336
    #85: https://govnokod.ru/27381 https://govnokod.xyz/_27381
    #86: https://govnokod.ru/27405 https://govnokod.xyz/_27405
    #87: https://govnokod.ru/27429 https://govnokod.xyz/_27429
    #88: https://govnokod.ru/27432 https://govnokod.xyz/_27432
    #89: https://govnokod.ru/27435 https://govnokod.xyz/_27435
    #90: https://govnokod.ru/27439 https://govnokod.xyz/_27439
    #91: https://govnokod.ru/27449 https://govnokod.xyz/_27449
    #92: https://govnokod.ru/27460 https://govnokod.xyz/_27460
    #93: https://govnokod.ru/27463 https://govnokod.xyz/_27463
    #94: https://govnokod.ru/27466 https://govnokod.xyz/_27466
    #95: https://govnokod.ru/27473 https://govnokod.xyz/_27473
    #96: https://govnokod.ru/27478 https://govnokod.xyz/_27478
    #97: https://govnokod.ru/27484 https://govnokod.xyz/_27484
    #98: https://govnokod.ru/27495 https://govnokod.xyz/_27495
    #99: https://govnokod.ru/27504 https://govnokod.xyz/_27504
    #100: https://govnokod.ru/27508 https://govnokod.xyz/_27508
    #101: https://govnokod.ru/27511 https://govnokod.xyz/_27511
    #102: https://govnokod.ru/27518 https://govnokod.xyz/_27518
    #103: https://govnokod.ru/27526 https://govnokod.xyz/_27526
    #104: https://govnokod.ru/27534 https://govnokod.xyz/_27534

    nepeKamHblu_nemyx, 01 Августа 2021

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

    +1

    1. 1
    Именно поэтому я за «PHP» #4

    #1: https://govnokod.ru/26462 https://govnokod.xyz/_26462
    #2: https://govnokod.ru/26827 https://govnokod.xyz/_26827
    #3: https://govnokod.ru/26832 https://govnokod.xyz/_26832

    nepeKamHblu_nemyx, 28 Июля 2021

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