# Benchmark package initial release

**URL:** <https://forums.swift.org/t/benchmark-package-initial-release/60535>\
**Category:** Benchmark\
**Tags:** linux, benchmarks, packagemanager, commandplugin\
**Created:** [September 27, 2022, 3:51pm UTC](https://forums.swift.org/t/benchmark-package-initial-release/60535 "2022-09-27T15:51:39Z")\
**Posts on this page:** 3\
**Page:** 4

<div class="post-metadata">

**Author:** ![hassila](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/hassila/32/22647_2.png) [@hassila](https://forums.swift.org/u/hassila)\
**Post date:** [March 15, 2023, 1:32pm UTC](https://forums.swift.org/t/benchmark-package-initial-release/60535/61 "2023-03-15T13:32:27Z")

</div>

> [@taylorswift](#):
>
> i don’t think this is an issue with the package, the package could just use some better documentation for the amazon linux 2 container use case.

Should be there in 0.9.0, thanks.

---

<div class="post-metadata">

**Author:** ![hassila](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/hassila/32/22647_2.png) [@hassila](https://forums.swift.org/u/hassila)\
**Post date:** [March 15, 2023, 4:29pm UTC](https://forums.swift.org/t/benchmark-package-initial-release/60535/62 "2023-03-15T16:29:30Z")

</div>

And a sample how a larger benchmark suite could look like:

> <https://github.com/apple/swift-nio/pull/2392>
>
> Adding support for package-benchmark
> 
> \### Motivation:
> 
> It'd be good to get a… wider range of metrics for some performance tests (e.g. UDP/TCP could provide context switches, syscalls etc) and also possibly clean up the integration testing of malloc stuff to be part of this as some of those tests seems duplicated.
> 
> This is a first stab at using \[package-benchmark\](https://swiftpackageindex.com/ordo-one/package-benchmark/main/documentation/benchmark) to get feedback from the NIO team.
> 
> To get fully comparable numbers, one might want to tweak the iterations (package-benchmark uses 1K or 1M as typical iteration counts, so 100K was rounded up to 1M for these tests).
> 
> \### Modifications:
> 
> Added a subdirectory with a separate project (as package-benchmark depends on jemalloc) to not add any dependencies to the main swift-nio repo
> 
> Basically the code from NIOPerformanceTester is copied over and made into a library target that is used by the benchmarks, major changes is making things public so the benchmarks can see them.
> 
> \`main.swift\` has been renamed \`Utilities.swift\` and just contains the supporting setup that was top level before, all the benchmarks have been migrated to the actual benchmark executable targets
> \`Benchmark.swift\` has been reduced to just define the protocols implemented by the NIO benchmarks (which are still in use to minimise the changes to the benchmarks themselves)
> The benchmarks classes have been made public to be accessible by the benchmark executable targets.
> 
> The actual benchmarks are largely untouched, do a diff vs the NIOPerformanceTester target directory and the original sources for overview (I didn't want to move them, as this PR could be landed first and then the legacy NIOPerformanceTester tests could be removed in a separate PR).
> 
> \### Result:
> 
> Wider range of benchmark metrics, richer set of PR threshold checks (usable for e.g. liburing work to see syscalls/context switches etc), better benchmark result analytics with comparisons possible between different NIO releases, less code.
> Possibility to kill the integration tests with malloc checks to something that will continuously will be updated (and possibly remove duplicated code there, as at a quick glance some of those tests are dups it seems?).
> 
> \### Tasks
> 
> \- \[\] Get feedback from NIO team on quality of measurements / setup
> \- \[\] Define acceptable thresholds for various metrics that can be compared with \`check\` (these can basically replace the old malloc counters in the integration test suite, not sure those tests are needed anymore, they at a quick glance looks like duplicates of the NIOPerformanceTester ones?)
> \- \[\] Integration with NIO build infrastructure (would need help with that) - \[sample GitHub workflow action\](https://raw.githubusercontent.com/ordo-one/package-benchmark/main/.github/workflows/benchmark-pr.yml)
> \- \[\] Try running with different NIO versions (would easiest be done by changing this package manifest to whatever version you want to test)
> \- \[\] Showcase output with JMH, Delta comparisons and checks versus different versions / PR:s
> \- \[\] Use wider range of metrics as required (started with e.g. UDPandTCP)
> \- \[\] Review / discussion of any minor benchmark changes done (fundamentally iteration count setup)

---

<div class="post-metadata">

**Author:** ![hassila](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/hassila/32/22647_2.png) [@hassila](https://forums.swift.org/u/hassila)\
**Post date:** [March 23, 2023, 8:30am UTC](https://forums.swift.org/t/benchmark-package-initial-release/60535/63 "2023-03-23T08:30:53Z")

</div>

> [@Benchmark stable release](https://forums.swift.org/t/benchmark-stable-release/63902):
>
> Hi, We're happy to announce that [Benchmark](https://github.com/ordo-one/package-benchmark) now has shipped with what we believe is an API stable interface (which follows semantic versioning) with significantly improved capabilities compared to the initial release last fall (several thanks to the new underpinning [Histogram](https://github.com/ordo-one/package-histogram) foundation) . [Shiny new documentation is available](https://swiftpackageindex.com/ordo-one/package-benchmark/documentation/benchmark) outlining both setup and how to write benchmarks, largely thanks to @Joseph_Heck and the DocC team (and SPI for hosting!). There are also some [sample code](https://github.com/ordo-one/package-benchmark-samples) on GitHub. For…

[Previous page](https://forums.swift.org/t/benchmark-package-initial-release/60535.md?page=3)
