Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@

*.rs linguist-language=Rust

*.html linguist-detectable=false
*.sh linguist-detectable=false
*.vimrc linguist-detectable=false
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# directories (by name)

/_build/
/_build-ci/
/scripts/__pycache__/
/scratch/
/target/

Expand All @@ -13,8 +15,6 @@

.DS_Store

#Cargo.lock


# files (by pattern)

Expand All @@ -24,3 +24,4 @@
*.swp
*.tmp
*.zip

70 changes: 70 additions & 0 deletions .vimrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
" Synesis C/C++ project .vimrc — aligned with .sis/.vscode/c_cxx/settings.json

set nocompatible
filetype indent plugin on
syntax enable
set autoindent
set backspace=indent,eol,start
set hlsearch
set incsearch
set number

" files.insertFinalNewline
set eol
set fixeol

" editor.renderWhitespace: all
set list
set listchars=tab:->,trail:-,extends:>,precedes:<,nbsp:+

" editor.detectIndentation: false — global defaults (editor.tabSize: 2, insertSpaces: false)
set tabstop=2
set shiftwidth=2
set softtabstop=2
set noexpandtab
set colorcolumn=76

" colorcolumn draws a full-column tint in Vim (not a VS Code-style 1px line).
" Keep it subtle via the ColorColumn highlight group; reapply after colorscheme changes.
if has('termguicolors')
" set termguicolors
endif

function! s:ConfigureColorColumn() abort
highlight ColorColumn ctermbg=236 guibg=#2a2a2a cterm=NONE gui=NONE
endfunction

call s:ConfigureColorColumn()
autocmd ColorScheme * call s:ConfigureColorColumn()

" files.trimTrailingWhitespace
autocmd BufWritePre * %s/\s\+$//e

augroup sis_c_cxx
autocmd!

" [c] / [cpp]
autocmd FileType c,cpp setlocal expandtab tabstop=4 shiftwidth=4 softtabstop=4 colorcolumn=60,64,68,72,76

" [rust]
autocmd FileType rs setlocal expandtab tabstop=4 shiftwidth=4 softtabstop=4 colorcolumn=76

" [cmake]
autocmd FileType cmake setlocal noexpandtab tabstop=4 shiftwidth=4 softtabstop=4

" [shellscript]
autocmd FileType sh,bash,zsh setlocal expandtab tabstop=2 shiftwidth=2 softtabstop=2 colorcolumn=60,76

" [bat]
autocmd FileType bat,dosbatch setlocal expandtab tabstop=4 shiftwidth=4 softtabstop=4 colorcolumn=60,76

" [json] / [markdown] / [yaml] / [ruby]
autocmd FileType json,markdown,yaml,ruby setlocal expandtab tabstop=2 shiftwidth=2 softtabstop=2

" [python]
autocmd FileType python setlocal expandtab tabstop=4 shiftwidth=4 softtabstop=4 colorcolumn=60,76

" [toml]
autocmd FileType toml setlocal noexpandtab tabstop=2 shiftwidth=2 softtabstop=2
augroup END

20 changes: 13 additions & 7 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,38 +1,44 @@
{
"[json]": {
"editor.tabSize": 2
"editor.insertSpaces": false,
"editor.tabSize": 2,
},
"[markdown]": {
"editor.insertSpaces": true,
"editor.tabSize": 2,
},
"[python]": {
"editor.insertSpaces": true,
"editor.rulers": [ 60, 76 ],
"editor.tabSize": 2
"editor.tabSize": 4,
},
"[ruby]": {
"editor.insertSpaces": true,
"editor.rulers": [ 60, 76 ],
"editor.tabSize": 2
"editor.tabSize": 2,
},
"[rust]": {
"editor.insertSpaces": true,
"editor.rulers": [ 60, 76 ],
"editor.tabSize": 4
"editor.tabSize": 4,
},
"[toml]": {
"editor.insertSpaces": false,
"editor.tabSize": 2
"editor.tabSize": 2,
},
"cmake.configureOnOpen": false,
"editor.detectIndentation": false,
"editor.insertSpaces": false,
"editor.renderWhitespace": "all",
"editor.rulers": [ 76 ],
"editor.tabSize": 2,
"files.insertFinalNewline": true,
"files.trimTrailingWhitespace": true,
"git.mergeEditor": false,
"rust-analyzer.cargo.noDefaultFeatures": true,
"rust-analyzer.cargo.features": [
"default"
"default",
],
"rust-analyzer.completion.autoimport.enable": false,
"rust-analyzer.showUnlinkedFileNotification": false
"rust-analyzer.showUnlinkedFileNotification": false,
}
11 changes: 7 additions & 4 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
# p99.Rust CHANGES <!-- omit in toc -->


## 0.0.2 - 13th July 2026
## 0.0.3 - 14th July 2026

* standardised project boilerplate: (**.gitattributes**, **.gitignore**, **.vimrc**, **.vscode/settings.json**); project files (**CHANGES.md**, **EXAMPLES.md**, **NEWS.md**, **README.md**, **TODO.md**);

#### Changes

* Added opt-in crate feature **`"binary-scaling"`** that replaces integer division with $2^{32}$ fixed-point binary scaling for all integer-based percentile queries (`value_at_p90()`, `value_at_p95()`, `value_at_p99()`, etc.), achieving a ~1.5x to 2x speedup with a small loss of accuracy;
* Added **`"null-feature"`** -- a no-op feature that has no effect but simplifies driver scripts that conditionally pass features;
## 0.0.2 - 13th July 2026

* added opt-in crate feature **`"binary-scaling"`** that replaces integer division with $2^{32}$ fixed-point binary scaling for all integer-based percentile queries (`#value_at_p90()`, `#value_at_p95()`, `#value_at_p99()`, etc.), achieving a ~1.5x to 2x speedup with a small loss of accuracy;
* added **`"null-feature"`** -- a no-op feature that has no effect but simplifies driver scripts that conditionally pass features;


## 0.0.1 - 26th June 2026
Expand Down
29 changes: 18 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ license = "BSD-3-Clause"
name = "p99"
readme = "README.md"
repository = "https://github.com/synesissoftware/p99.Rust"
version = "0.0.2"
version = "0.0.3"


# ##########################################################
Expand Down
9 changes: 9 additions & 0 deletions EXAMPLES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# p99.Rust Examples <!-- omit it toc -->


|Name|Source & Description|Summary|
|---|---|---|
|**build_histogram**|[examples/build_histogram/main.rs](/examples/build_histogram/main.rs)<br/>[examples/build_histogram.md](/examples/build_histogram.md)|Lists files in the current directory whose paths match one or more shell wildcard pattern(s), using `shwild::matches()`.|


<!-- ########################### end of file ########################### -->
11 changes: 11 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# p99.Rust - NEWS <!-- omit in toc -->

| Date | News Item |
| --------------------- | ----------------------------------------- |
| 14th July 2026 | p99.Rust 0.0.3 released |
| 13th July 2026 | p99.Rust 0.0.2 released |
| 26th June 2026 | p99.Rust 0.0.1 released |


<!-- ########################### end of file ########################### -->

41 changes: 22 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,29 @@ Low-cost generation of performance percentiles (p50, p90, p99, p99.9, etc.).
- [Introduction](#introduction)
- [How It Works](#how-it-works)
- [Performance \& Trade-offs](#performance--trade-offs)
- [Performance Claims](#performance-claims)
- [Trade-offs \& Sacrifices](#trade-offs--sacrifices)
- [Performance Claims](#performance-claims)
- [Trade-offs \& Sacrifices](#trade-offs--sacrifices)
- [Installation](#installation)
- [Components](#components)
- [Constants](#constants)
- [Enumerations](#enumerations)
- [Features](#features)
- [Functions](#functions)
- [Macros](#macros)
- [Structures](#structures)
- [`Histogram`](#histogram)
- [Definition](#definition)
- [Minimal Example](#minimal-example)
- [Traits](#traits)
- [Constants](#constants)
- [Enumerations](#enumerations)
- [Features](#features)
- [Enabling `binary-scaling`](#enabling-binary-scaling)
- [Benchmark Results](#benchmark-results)
- [Functions](#functions)
- [Macros](#macros)
- [Structures](#structures)
- [`Histogram`](#histogram)
- [Definition](#definition)
- [Minimal Example](#minimal-example)
- [Traits](#traits)
- [Examples](#examples)
- [Project Information](#project-information)
- [Where to get help](#where-to-get-help)
- [Contribution guidelines](#contribution-guidelines)
- [Dependencies](#dependencies)
- [Dev Dependencies](#dev-dependencies)
- [License](#license)
- [Where to get help](#where-to-get-help)
- [Contribution guidelines](#contribution-guidelines)
- [Dependencies](#dependencies)
- [Dev Dependencies](#dev-dependencies)
- [License](#license)


## Introduction
Expand Down Expand Up @@ -104,9 +106,10 @@ No public enumerations are defined at this time.

The following crate features are available:

* **`binary-scaling`** *(opt-in)*: Replaces integer division in the integer-based percentile methods (`value_at_p90()`, `value_at_p95()`, `value_at_p99()`, etc.) with $2^{32}$ fixed-point binary scaling. Each percentile multiplier (e.g., `0.90` for p90) is pre-encoded as a `u32` constant and the target rank is computed via a single multiplication and a 32-bit right-shift, avoiding the cost of integer division entirely. This yields a **~1.5x to 2x speedup** for percentile queries with a negligible loss of accuracy (the scaled multiplier differs from the true value by less than $10^{-9}$). The generic `value_at_percentile(f64)` method is unaffected by this feature.
* **`"binary-scaling"`** *(opt-in)*: Replaces integer division in the integer-based percentile methods (`#value_at_p90()`, `#value_at_p95()`, `#value_at_p99()`, etc.) with $2^{32}$ fixed-point binary scaling. Each percentile multiplier (e.g., `0.90` for p90) is pre-encoded as a `u32` constant and the target rank is computed via a single multiplication and a 32-bit right-shift, avoiding the cost of integer division entirely. This yields a **~1.5x to 2x speedup** for percentile queries with a negligible loss of accuracy (the scaled multiplier differs from the true value by less than $10^{-9}$). The generic `#value_at_percentile(f64)` method is unaffected by this feature;

* **`"null-feature"`** *(opt-in)*: A no-op feature that has no effect on the compiled library. It exists to simplify driver scripts and CI pipelines that conditionally pass `--features` flags, allowing a feature list to always be present even when no real features are needed;

* **`null-feature`** *(opt-in)*: A no-op feature that has no effect on the compiled library. It exists to simplify driver scripts and CI pipelines that conditionally pass `--features` flags, allowing a feature list to always be present even when no real features are needed.

#### Enabling `binary-scaling`

Expand Down
20 changes: 17 additions & 3 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
# p99.Rust <!-- omit in toc -->
# p99.Rust - TODO <!-- omit in toc -->


## Table of Contents <!-- omit in toc -->

- [TODOs](#todos)
- [Functional improvements](#functional-improvements)
- [Performance improvements](#performance-improvements)
- [Packaging improvements](#packaging-improvements)


## TODOs
## Functional improvements

- [x] ~~~`Debug` form~~~;
- [x] ~~~binary scaling~~~;


## Performance improvements

- [x] ~~~binary scaling~~~;


## Packaging improvements

* \<none>


<!-- ########################### end of file ########################### -->
Loading
Loading