# Speed-up issue with futures (CS)

**URL:** <https://racket.discourse.group/t/speed-up-issue-with-futures-cs/1328>\
**Category:** General\
**Created:** [September 26, 2022, 3:14pm UTC](https://racket.discourse.group/t/speed-up-issue-with-futures-cs/1328 "2022-09-26T15:14:36Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![Laurent.O](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/laurent.o/32/18_2.png) [@Laurent.O](https://racket.discourse.group/u/Laurent.O)\
**Post date:** [September 26, 2022, 3:14pm UTC](https://racket.discourse.group/t/speed-up-issue-with-futures-cs/1328/1 "2022-09-26T15:14:36Z")

</div>

I have a naive `softmax`-like function that is decently sped-up by futures (10x on the machine I'm using), but is numerically unstable. When I try to use the standard "subtract the max" trick, it does become stable, but futures don't help at all anymore.

This is really surprising because the stable version is written in a way that it should do no more than twice the amount of computation of the unstable version:

[softmax.rkt gist](https://gist.github.com/Metaxal/498d66bc14903efe45a78b0da3f7e4fc)

**TLDR:** Take a look at the table of results at the end of the link above (in particular the `real time` values).

Any help would be very appreciated!

---

_[View the full topic](https://racket.discourse.group/t/speed-up-issue-with-futures-cs/1328)._
