Brunobkr/llama.cpp_AlgMor24_github
ΩFFFΣLLIa • llama.cpp • AlgMor24 ██████╗ ███████╗███████╗███████╗██╗ ██╗ ██╗ █████╗ ██╔═══██╗██╔════╝██╔════╝██╔════╝██║ ██║ ██║██╔══██╗ ██║ ██║█████╗ █████╗ █████╗ ██║ ██║ ██║███████║ ██║ ██║██╔══╝ ██╔══╝ ██╔══╝ ██║ ██║ ██║██╔══██║ ╚██████╔╝██║ ██║ ███████╗███████╗███████╗██║██║ ██║ ╚═════╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝╚══════╝╚═╝╚═╝ ╚═╝ High-Performance LLM / VLM Inference & Autonomous Agentic Ecosystem… See the full description on the dataset page: https://huggingface.co/datasets/Brunobkr/llama.cpp_AlgMor24_github.
03.1k
1_I'm transitioning to a full-time open source career. Your support would be greatly appreciated 🙌_2<a href="https://polar.sh/tinylibs/subscriptions"><picture><source media="(prefers-color-scheme: dark)" srcset="https://polar.sh/embed/tiers.svg?org=tinylibs&darkmode"><img alt="Subscription Tiers on Polar" src="https://polar.sh/embed/tiers.svg?org=tinylibs"></picture></a>3 4# Tinybench 🔎5 6[](https://github.com/tinylibs/tinybench/actions/workflows/test.yml)7[](https://www.npmjs.com/package/tinybench)8 9Benchmark your code easily with Tinybench, a simple, tiny and light-weight `7KB` (`2KB` minified and gzipped)10benchmarking library!11You can run your benchmarks in multiple JavaScript runtimes, Tinybench is12completely based on the Web APIs with proper timing using `process.hrtime` or13`performance.now`.14 15- Accurate and precise timing based on the environment16- `Event` and `EventTarget` compatible events17- Statistically analyzed values18- Calculated Percentiles19- Fully detailed results20- No dependencies21 22_In case you need more tiny libraries like tinypool or tinyspy, please consider submitting an [RFC](https://github.com/tinylibs/rfcs)_23 24## Installing25 26```bash27$ npm install -D tinybench28```29 30## Usage31 32You can start benchmarking by instantiating the `Bench` class and adding33benchmark tasks to it.34 35```js36import { Bench } from 'tinybench';37 38const bench = new Bench({ time: 100 });39 40bench41 .add('faster task', () => {42 console.log('I am faster')43 })44 .add('slower task', async () => {45 await new Promise(r => setTimeout(r, 1)) // we wait 1ms :)46 console.log('I am slower')47 })48 .todo('unimplemented bench')49 50await bench.warmup(); // make results more reliable, ref: https://github.com/tinylibs/tinybench/pull/5051await bench.run();52 53console.table(bench.table());54 55// Output:56// ┌─────────┬───────────────┬──────────┬────────────────────┬───────────┬─────────┐57// │ (index) │ Task Name │ ops/sec │ Average Time (ns) │ Margin │ Samples │58// ├─────────┼───────────────┼──────────┼────────────────────┼───────────┼─────────┤59// │ 0 │ 'faster task' │ '41,621' │ 24025.791819761525 │ '±20.50%' │ 4257 │60// │ 1 │ 'slower task' │ '828' │ 1207382.7838323202 │ '±7.07%' │ 83 │61// └─────────┴───────────────┴──────────┴────────────────────┴───────────┴─────────┘62 63console.table(64 bench.table((task) => ({'Task name': task.name}))65);66 67// Output:68// ┌─────────┬───────────────────────┐69// │ (index) │ Task name │70// ├─────────┼───────────────────────┤71// │ 0 │ 'unimplemented bench' │72// └─────────┴───────────────────────┘73```74 75The `add` method accepts a task name and a task function, so it can benchmark76it! This method returns a reference to the Bench instance, so it's possible to77use it to create an another task for that instance.78 79Note that the task name should always be unique in an instance, because Tinybench stores the tasks based80on their names in a `Map`.81 82Also note that `tinybench` does not log any result by default. You can extract the relevant stats83from `bench.tasks` or any other API after running the benchmark, and process them however you want.84 85## Docs86 87### `Bench`88 89The Benchmark instance for keeping track of the benchmark tasks and controlling90them.91 92Options:93 94```ts95export type Options = {96 /**97 * time needed for running a benchmark task (milliseconds) @default 50098 */99 time?: number;100 101 /**102 * number of times that a task should run if even the time option is finished @default 10103 */104 iterations?: number;105 106 /**107 * function to get the current timestamp in milliseconds108 */109 now?: () => number;110 111 /**112 * An AbortSignal for aborting the benchmark113 */114 signal?: AbortSignal;115 116 /**117 * Throw if a task fails (events will not work if true)118 */119 throws?: boolean;120 121 /**122 * warmup time (milliseconds) @default 100ms123 */124 warmupTime?: number;125 126 /**127 * warmup iterations @default 5128 */129 warmupIterations?: number;130 131 /**132 * setup function to run before each benchmark task (cycle)133 */134 setup?: Hook;135 136 /**137 * teardown function to run after each benchmark task (cycle)138 */139 teardown?: Hook;140};141 142export type Hook = (task: Task, mode: "warmup" | "run") => void | Promise<void>;143```144 145- `async run()`: run the added tasks that were registered using the `add` method146- `async runConcurrently(threshold: number = Infinity, mode: "bench" | "task" = "bench")`: similar to the `run` method but runs concurrently rather than sequentially. See the [Concurrency](#Concurrency) section. 147- `async warmup()`: warm up the benchmark tasks148- `async warmupConcurrently(threshold: number = Infinity, mode: "bench" | "task" = "bench")`: warm up the benchmark tasks concurrently149- `reset()`: reset each task and remove its result150- `add(name: string, fn: Fn, opts?: FnOpts)`: add a benchmark task to the task map151 - `Fn`: `() => any | Promise<any>`152 - `FnOpts`: `{}`: a set of optional functions run during the benchmark lifecycle that can be used to set up or tear down test data or fixtures without affecting the timing of each task153 - `beforeAll?: () => any | Promise<any>`: invoked once before iterations of `fn` begin154 - `beforeEach?: () => any | Promise<any>`: invoked before each time `fn` is executed155 - `afterEach?: () => any | Promise<any>`: invoked after each time `fn` is executed156 - `afterAll?: () => any | Promise<any>`: invoked once after all iterations of `fn` have finished157- `remove(name: string)`: remove a benchmark task from the task map158- `table()`: table of the tasks results159- `get results(): (TaskResult | undefined)[]`: (getter) tasks results as an array160- `get tasks(): Task[]`: (getter) tasks as an array161- `getTask(name: string): Task | undefined`: get a task based on the name162- `todo(name: string, fn?: Fn, opts: FnOptions)`: add a benchmark todo to the todo map163- `get todos(): Task[]`: (getter) tasks todos as an array164 165### `Task`166 167A class that represents each benchmark task in Tinybench. It keeps track of the168results, name, Bench instance, the task function and the number of times the task169function has been executed.170 171- `constructor(bench: Bench, name: string, fn: Fn, opts: FnOptions = {})`172- `bench: Bench`173- `name: string`: task name174- `fn: Fn`: the task function175- `opts: FnOptions`: Task options176- `runs: number`: the number of times the task function has been executed177- `result?: TaskResult`: the result object178- `async run()`: run the current task and write the results in `Task.result` object179- `async warmup()`: warm up the current task180- `setResult(result: Partial<TaskResult>)`: change the result object values181- `reset()`: reset the task to make the `Task.runs` a zero-value and remove the `Task.result` object182 183```ts184export interface FnOptions {185 /**186 * An optional function that is run before iterations of this task begin187 */188 beforeAll?: (this: Task) => void | Promise<void>;189 190 /**191 * An optional function that is run before each iteration of this task192 */193 beforeEach?: (this: Task) => void | Promise<void>;194 195 /**196 * An optional function that is run after each iteration of this task197 */198 afterEach?: (this: Task) => void | Promise<void>;199 200 /**201 * An optional function that is run after all iterations of this task end202 */203 afterAll?: (this: Task) => void | Promise<void>;204}205```206 207## `TaskResult`208 209the benchmark task result object.210 211```ts212export type TaskResult = {213 214 /*215 * the last error that was thrown while running the task216 */217 error?: unknown;218 219 /**220 * The amount of time in milliseconds to run the benchmark task (cycle).221 */222 totalTime: number;223 224 /**225 * the minimum value in the samples226 */227 min: number;228 /**229 * the maximum value in the samples230 */231 max: number;232 233 /**234 * the number of operations per second235 */236 hz: number;237 238 /**239 * how long each operation takes (ms)240 */241 period: number;242 243 /**244 * task samples of each task iteration time (ms)245 */246 samples: number[];247 248 /**249 * samples mean/average (estimate of the population mean)250 */251 mean: number;252 253 /**254 * samples variance (estimate of the population variance)255 */256 variance: number;257 258 /**259 * samples standard deviation (estimate of the population standard deviation)260 */261 sd: number;262 263 /**264 * standard error of the mean (a.k.a. the standard deviation of the sampling distribution of the sample mean)265 */266 sem: number;267 268 /**269 * degrees of freedom270 */271 df: number;272 273 /**274 * critical value of the samples275 */276 critical: number;277 278 /**279 * margin of error280 */281 moe: number;282 283 /**284 * relative margin of error285 */286 rme: number;287 288 /**289 * p75 percentile290 */291 p75: number;292 293 /**294 * p99 percentile295 */296 p99: number;297 298 /**299 * p995 percentile300 */301 p995: number;302 303 /**304 * p999 percentile305 */306 p999: number;307};308```309 310### `Events`311 312Both the `Task` and `Bench` objects extend the `EventTarget` object, so you can attach listeners to different types of events313in each class instance using the universal `addEventListener` and314`removeEventListener`.315 316```ts317/**318 * Bench events319 */320export type BenchEvents =321 | "abort" // when a signal aborts322 | "complete" // when running a benchmark finishes323 | "error" // when the benchmark task throws324 | "reset" // when the reset function gets called325 | "start" // when running the benchmarks gets started326 | "warmup" // when the benchmarks start getting warmed up (before start)327 | "cycle" // when running each benchmark task gets done (cycle)328 | "add" // when a Task gets added to the Bench329 | "remove" // when a Task gets removed of the Bench330 | "todo"; // when a todo Task gets added to the Bench331 332/**333 * task events334 */335export type TaskEvents =336 | "abort"337 | "complete"338 | "error"339 | "reset"340 | "start"341 | "warmup"342 | "cycle";343```344 345For instance:346 347```js348// runs on each benchmark task's cycle349bench.addEventListener("cycle", (e) => {350 const task = e.task!;351});352 353// runs only on this benchmark task's cycle354task.addEventListener("cycle", (e) => {355 const task = e.task!;356});357```358 359### `BenchEvent`360 361```ts362export type BenchEvent = Event & {363 task: Task | null;364};365```366 367### `process.hrtime`368if you want more accurate results for nodejs with `process.hrtime`, then import369 the `hrtimeNow` function from the library and pass it to the `Bench` options.370 371```ts372import { hrtimeNow } from 'tinybench';373```374It may make your benchmarks slower, check #42.375 376## Concurrency377 378- When `mode` is set to `null` (default), concurrency is disabled.379- When `mode` is set to 'task', each task's iterations (calls of a task function) run concurrently.380- When `mode` is set to 'bench', different tasks within the bench run concurrently. Concurrent cycles.381 382```ts383// options way (recommended)384bench.threshold = 10 // The maximum number of concurrent tasks to run. Defaults to Infinity.385bench.concurrency = "task" // The concurrency mode to determine how tasks are run. 386// await bench.warmup()387await bench.run()388 389// standalone method way390// await bench.warmupConcurrently(10, "task")391await bench.runConcurrently(10, "task") // with runConcurrently, mode is set to 'bench' by default392```393 394## Prior art395 396- [Benchmark.js](https://github.com/bestiejs/benchmark.js)397- [Mitata](https://github.com/evanwashere/mitata/)398- [Bema](https://github.com/prisma-labs/bema)399 400## Authors401 402| <a href="https://github.com/Aslemammad"> <img width='150' src="https://avatars.githubusercontent.com/u/37929992?v=4" /><br> Mohammad Bagher </a> |403| ------------------------------------------------------------------------------------------------------------------------------------------------ |404 405## Credits406 407| <a href="https://github.com/uzlopak"> <img width='150' src="https://avatars.githubusercontent.com/u/5059100?v=4" /><br> Uzlopak </a> | <a href="https://github.com/poyoho"> <img width='150' src="https://avatars.githubusercontent.com/u/36070057?v=4" /><br> poyoho </a> |408| ------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------- |409 410## Contributing411 412Feel free to create issues/discussions and then PRs for the project!413 414## Sponsors415 416Your sponsorship can make a huge difference in continuing our work in open source!417 418<p align="center">419 <a href="https://cdn.jsdelivr.net/gh/aslemammad/static/sponsors.svg">420 <img src='https://cdn.jsdelivr.net/gh/aslemammad/static/sponsors.svg'/>421 </a>422</p>423 