GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — cppbor/bench.cpp at 0e9cc0790a073f02700ae4035745b2cd2f8c0637 · RantyDave/cppbor

Expand file tree

/

bench.cpp

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
32 lines (27 loc) · 976 Bytes
/

bench.cpp

Copy path

File metadata and controls

32 lines (27 loc) · 976 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <iostream>
#include <chrono>
#include "cppbor/cppbor.hpp"
using namespace std;
using namespace std::chrono;
int main()
{
// open file, find it's size
FILE* f=fopen("../cbor-python-wrote", "r");
fseek(f , 0 , SEEK_END);
size_t size=static_cast<size_t>(ftell(f));
rewind(f);
// create and load into buffer
vector<uint8_t> cbor_data_in(size);
fread(cbor_data_in.data(), size, 1, f);
fclose(f);
// decode cbor
high_resolution_clock::time_point start=high_resolution_clock::now();
cbor_variant cbor_original;
cbor_variant::construct_from_into(cbor_data_in, &cbor_original);
high_resolution_clock::time_point end=high_resolution_clock::now();
// report
duration<float> time_taken=duration_cast<duration<float>>(end-start);
cout << "Places: " << get<cbor_map>(cbor_original).size() << endl;
cout << "Parse time: " << time_taken.count() << endl;
// cout << cbor_original.as_python() << endl;
}
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.