The Wayback Machine - https://web.archive.org/web/20201206004814/https://github.com/bazelbuild/bazel
Skip to content
master
Go to file
Code

Latest commit

`Math.floorDiv` does multiplication to compute a remainder.

JVM is supposed to
[detect a pair of division and remainder](http://hg.openjdk.java.net/jdk9/jdk9/hotspot/file/jdk-9+181/src/share/vm/opto/compile.cpp#l3176)
when C2 is kicked in, but somehow it seems to not do it on my laptop.

Benchmark can be made a little even more faster by
[adding `yl - 1` instead of multiplication](https://git.io/JIYY6)
but better keep implementation simple.

Anyway, using `Math.floorDiv` is a safe bet.

```
def test():
    for i in range(10):
        print(i)
        for j in range(1000000):
            1 // 100
            1000 // 20
            -1 // 30
            -33 // 9
            500000 / 22
            1 // 100
            1000 // 20
            1 // 30
            3306 // 11
            500000 // 22

test()
```

```
A: n=80 mean=5.149 std=0.317 se=0.035 min=4.709 med=5.102
B: n=80 mean=4.634 std=0.280 se=0.031 min=4.234 med=4.552
B/A: 0.900 0.883..0.918 (95% conf)
```

Closes #12621.

PiperOrigin-RevId: 345857371
46468e4

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time

README.md

Bazel

{Fast, Correct} - Choose two

Build and test software of any size, quickly and reliably.

  • Speed up your builds and tests: Bazel rebuilds only what is necessary. With advanced local and distributed caching, optimized dependency analysis and parallel execution, you get fast and incremental builds.

  • One tool, multiple languages: Build and test Java, C++, Android, iOS, Go, and a wide variety of other language platforms. Bazel runs on Windows, macOS, and Linux.

  • Scalable: Bazel helps you scale your organization, codebase, and continuous integration solution. It handles codebases of any size, in multiple repositories or a huge monorepo.

  • Extensible to your needs: Easily add support for new languages and platforms with Bazel's familiar extension language. Share and re-use language rules written by the growing Bazel community.

Getting Started

Documentation

Contributing to Bazel

See CONTRIBUTING.md

Build status

You can’t perform that action at this time.