Difference between revisions of "User:Ssvb"

From D Wiki
Jump to: navigation, search
(Arithmetic overflows)
(GDC LTO)
 
(14 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
== D language for programming competitions ==
 +
 +
Not everything is perfect:
 +
 +
* Hash tables are vulnerable: https://issues.dlang.org/show_bug.cgi?id=7179 and https://codeforces.com/contest/1676/submission/156707849
 +
* Arithmetic overflows detection is not the best
 +
* 128-bit data type is missing
 +
* [https://github.com/dlang/phobos/blob/master/std/bigint.d std.bigint] is slow (not using GMP as a backend)
 +
* [https://github.com/dlang/phobos/blob/master/std/random.d std.random] is slow: https://codeforces.com/blog/entry/99292#comment-881097
 +
 
== GDC tips and tricks ==
 
== GDC tips and tricks ==
  
Line 8: Line 18:
  
 
Mingw build and test instructions: TODO
 
Mingw build and test instructions: TODO
 +
 +
== GDC LTO ==
 +
 +
* https://gcc.gnu.org/onlinedocs/gccint/LTO-Overview.html
 +
* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59893
 +
 +
Use readelf with "--lto-syms" option to inspect the static Phobos library. Compile libraries with "-flto -ffat-lto-objects".
  
 
== Arithmetic overflows ==
 
== Arithmetic overflows ==
Line 31: Line 48:
 
* https://lists.gnu.org/archive/html/bug-gnulib/2006-12/msg00094.html
 
* https://lists.gnu.org/archive/html/bug-gnulib/2006-12/msg00094.html
 
* https://gcc.gnu.org/legacy-ml/gcc/2008-02/msg00732.html
 
* https://gcc.gnu.org/legacy-ml/gcc/2008-02/msg00732.html
 +
 +
== Associative arrays and hash collisions ==
 +
 +
https://forum.dlang.org/post/navsnrjweslsqeaawsev@forum.dlang.org
 +
 +
A hacked solution on codeforces (integers): https://codeforces.com/contest/1676/submission/156707849
 +
A hacked solution on codeforces (strings): https://codeforces.com/contest/1703/submission/163949653
 +
 +
Relevant links:
 +
* https://en.wikipedia.org/wiki/Collision_attack#Hash_flooding
 +
* https://en.wikipedia.org/wiki/SipHash
 +
* https://github.com/google/highwayhash ("Defending against hash flooding" section)
 +
* https://github.com/google/highwayhash/issues/28
 +
* https://github.com/tkaitchuck/aHash/blob/master/compare/readme.md
 +
* https://www.josephkirwin.com/2018/04/07/z3-hash-inversions
 +
* http://emboss.github.io/blog/2012/12/14/breaking-murmur-hash-flooding-dos-reloaded/
 +
 +
== Long term support version of D language ==
 +
 +
The 2.076 frontend from GDC 9/10/11 can be essentially treated as a D language "edition 2017". This old frontend can be also added to GDC 12 by essentially reverting the frontend upgrade commits, but preferably both frontends should be supported in a single compiler release and selected via '-std=' option.
 +
 +
* https://forum.dlang.org/post/sysghhzfdyojcbosxlkm@forum.dlang.org
 +
 +
Victims of compatibility breaking changes:
 +
* https://forum.dlang.org/post/t7lqbe$1cmn$1@digitalmars.com
 +
* https://forum.dlang.org/post/bwjrwzpqmidhcgdybnom@forum.dlang.org
 +
* https://forum.dlang.org/post/g0sa4j$2fmf$1@digitalmars.com
 +
 +
D1 support story:
 +
* https://forum.dlang.org/post/svkdolzzcqotdmifcawh@forum.dlang.org
 +
* https://forum.dlang.org/post/mailman.722.1337004471.24740.digitalmars-d@puremagic.com
 +
* https://forum.dlang.org/post/amxfqaljlitgapqhrtox@forum.dlang.org

Latest revision as of 13:40, 14 December 2023

D language for programming competitions

Not everything is perfect:

GDC tips and tricks

GDC 11+ requires "-flto" or "-fno-weak-templates" option to avoid a major performance regression: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102765

Shared library linking workaround to run phobos unit tests: https://bugzilla.gdcproject.org/show_bug.cgi?id=199

Demangle symbols: https://dlang.org/phobos/std_demangle.html

Mingw build and test instructions: TODO

GDC LTO

Use readelf with "--lto-syms" option to inspect the static Phobos library. Compile libraries with "-flto -ffat-lto-objects".

Arithmetic overflows

TODO: create a new DIP? https://forum.dlang.org/post/rclilxjpnjvexggncfhd@forum.dlang.org

TODO: Atomic operations and arithmetic overflows?

TODO: Unsigned overflows?

GDC supports "-ftrapv" easter egg option for trapping signed overflows.

Relevant links:

GCC history of -fno-strict-aliasing and -fwrapv:

Associative arrays and hash collisions

https://forum.dlang.org/post/navsnrjweslsqeaawsev@forum.dlang.org

A hacked solution on codeforces (integers): https://codeforces.com/contest/1676/submission/156707849 A hacked solution on codeforces (strings): https://codeforces.com/contest/1703/submission/163949653

Relevant links:

Long term support version of D language

The 2.076 frontend from GDC 9/10/11 can be essentially treated as a D language "edition 2017". This old frontend can be also added to GDC 12 by essentially reverting the frontend upgrade commits, but preferably both frontends should be supported in a single compiler release and selected via '-std=' option.

Victims of compatibility breaking changes:

D1 support story: