Comments (7)
Ok, I found the old fix I did for XMRig: xmrig/xmrig@75c57f7
This is now in #9042 and #9043
from monero.
There is no point to optimize this part of the code. Even when Cryptonight was Monero's PoW, this function accounted for < 0.1% of the hashing time, at best. Right now Cryptonight is only used as a key derivation function (KDF) for wallet files.
from monero.
This is a compiler bug, because gcc 9.4.0 compiles it correctly:
root@Ubuntu-2004-focal-64-minimal-hwe ~/jh # ls -la
total 44
drwxr-xr-x 2 root root 4096 Oct 27 13:56 .
drwx------ 8 root root 4096 Oct 27 13:55 ..
-rw-r--r-- 1 root root 25746 Aug 27 2021 jh.c
-rw-r--r-- 1 root root 849 Aug 27 2021 jh.h
-rw-r--r-- 1 root root 1489 Oct 27 13:55 main.c
root@Ubuntu-2004-focal-64-minimal-hwe ~/jh # gcc -O3 *.c -o test
root@Ubuntu-2004-focal-64-minimal-hwe ~/jh # ./test
0xea252e4fe0d223d17925f61058e2809da4896f12db26fce35faa5534575b8ce0
root@Ubuntu-2004-focal-64-minimal-hwe ~/jh # gcc -Ofast *.c -o test
root@Ubuntu-2004-focal-64-minimal-hwe ~/jh # ./test
0xea252e4fe0d223d17925f61058e2809da4896f12db26fce35faa5534575b8ce0
root@Ubuntu-2004-focal-64-minimal-hwe ~/jh # gcc --version
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
from monero.
Incorrect result for gcc 11.4.0 confirmed:
root@Ubuntu-2004-focal-64-minimal-hwe ~/jh # gcc-11 -O3 *.c -o test
root@Ubuntu-2004-focal-64-minimal-hwe ~/jh # ./test
0x48e84a3a785b8d5038d46c46ad4a09e2b8e019a6a8450acec7f36851c8dab0a7
root@Ubuntu-2004-focal-64-minimal-hwe ~/jh # gcc-11 --version
gcc-11 (Ubuntu 11.4.0-2ubuntu1~20.04) 11.4.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
from monero.
If I compile with UB sanitizer, the error magically disappears, and no undefined behavior is found:
root@Ubuntu-2004-focal-64-minimal-hwe ~/jh # gcc-11 -O3 *.c -o test -fsanitize=undefined
root@Ubuntu-2004-focal-64-minimal-hwe ~/jh # ./test
0xea252e4fe0d223d17925f61058e2809da4896f12db26fce35faa5534575b8ce0
So it's a compiler bug.
from monero.
@SChernykh Thanks for your fix.
from monero.
I have seen https://www3.ntu.edu.sg/home/wuhj/research/jh/jh_sse2_opt64.h is optimize for sse2 and it 3 times faster. Do you have a plan to support it ? @SChernykh thanks!
from monero.
Related Issues (20)
- [Discussion] Blockers towards including Rust into monero codebase HOT 4
- Support getting unconfirmed transfers from monero-wallet-rpc without fetching from pool
- Support updating the pool state in monero-wallet-rpc `refresh`
- Immediate Crash on Launch with Qt Quick Errors and OpenGL Context Failure in monero-wallet-gui HOT 1
- Hide the sending address and prompt that destinations do not exist HOT 5
- Build failure with Boost 1.85.0 HOT 4
- The Monero core software wallet API will (probably) switch from 'wallet2.h' to 'wallet2_api.h'
- Remove refresh from call from import_multisig HOT 3
- Daemon recurring error message HOT 9
- Daemon crashed last night with only a warning HOT 18
- A lot of 150/2 transactions in the txpool causes memory spike / OOM HOT 34
- aggregating multisig partial signatures HOT 8
- Cannot connect wallet client to daemon HOT 9
- About Artificial Intelligence and digital currencies(Feature) HOT 1
- Build unsigned transaction does not return "tx_blob" and "unsigned_txset" HOT 3
- build NOTFOUND Z alpine, what's missing? HOT 1
- Wallet corruption while storing
- Offline wallet is considered as "Hot" HOT 6
- [Proposal] Change how transactions are broadcasted to significantly reduce P2P bandwidth usage HOT 32
- daemon can send duplicate transactions, causing disconnects
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from monero.