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
26 changes: 14 additions & 12 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: Build and upload to PyPI

on: push
on:
push:
workflow_dispatch:

jobs:
build_wheels:
Expand All @@ -17,11 +19,12 @@ jobs:
- uses: actions/checkout@v4

- name: Build wheels
uses: pypa/cibuildwheel@v2.16.2
uses: pypa/cibuildwheel@v2.16.5

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
path: ./wheelhouse/*.whl
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: wheelhouse/*.whl

build_sdist:
name: Build source distribution
Expand All @@ -32,8 +35,9 @@ jobs:
- name: Build sdist
run: pipx run build --sdist

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz

upload_pypi:
Expand All @@ -44,15 +48,13 @@ jobs:
url: https://pypi.org/p/mrhttp
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
if: startsWith(github.ref, 'refs/tags/v') # only publish to PyPI on tag pushes
steps:
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
# unpacks default artifact into dist/
# if `name: artifact` is omitted, the action will create extra parent dir
name: artifact
pattern: cibw-*
path: dist
merge-multiple: true


- uses: pypa/gh-action-pypi-publish@release/v1
# with:
# repository-url: https://test.pypi.org/legacy/
4 changes: 2 additions & 2 deletions gbench/bld
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#
#g++ t.cpp -O3 -msse4.2 -mavx2 -std=c++11 -lbenchmark -lpthread -o t
#g++ tst.cpp -O3 -msse4.2 -mavx2 -std=c++11 -lbenchmark -lpthread -o tst
#g++ parse.cpp -O3 -msse4.2 -mavx2 -std=c++11 -lbenchmark -lpthread -o parse
g++ parse.cpp -O3 -msse4.2 -mavx2 -std=c++11 -lbenchmark -lpthread -o parse
#g++ string.cpp -O0 -msse4.2 -mavx2 -std=c++11 -lbenchmark -lpthread -o string
#g++ query.cpp -O0 -msse4.2 -mavx2 -std=c++11 -lbenchmark -lpthread -o query
g++ rand.cpp -O3 -msse4.2 -mavx2 -std=c++11 -lbenchmark -lpthread -o orand
#g++ rand.cpp -O3 -msse4.2 -mavx2 -std=c++11 -lbenchmark -lpthread -o orand

14 changes: 7 additions & 7 deletions gbench/parse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ std::size_t slow_hparse(std::string &text) noexcept
int last = 0;
int index = 0;

for (std::uint64_t i = 0; i < text.length(); i++)
for (int i = 0; i < text.length(); i++)
{
if ( text[i] == ':' ) {
keys[index] = text.substr( last, i-last );
Expand Down Expand Up @@ -1234,13 +1234,13 @@ static void BM_get_session_avx2(benchmark::State& state) {


//BENCHMARK(BM_SlowParse);
BENCHMARK(BM_sse4_get_eol);
BENCHMARK(BM_my_get_eol);
//BENCHMARK(BM_my3_header_parse);
//BENCHMARK(BM_my2_header_parse);
//BENCHMARK(BM_sse4_get_eol);
//BENCHMARK(BM_my_get_eol);
BENCHMARK(BM_my3_header_parse);
BENCHMARK(BM_my2_header_parse);
//BENCHMARK(BM_my_header_parse);
//BENCHMARK(BM_old_header_parse);
//BENCHMARK(BM_avx2_header_parse);
BENCHMARK(BM_old_header_parse);
BENCHMARK(BM_avx2_header_parse);
//BENCHMARK(BM_adv_token);
//BENCHMARK(BM_adv_token_avx2);
//BENCHMARK(BM_get_session);
Expand Down
9 changes: 9 additions & 0 deletions src/mrhttp/utils/unpack.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@


#include "unpack.h"
#include "py_defines.h"
#include <time.h>
Expand Down Expand Up @@ -48,6 +49,14 @@ PyObject *decode( char *s, char *end) {
o = PyUnicode_FromStringAndSize( s, l );
s += l;
}
else if ( *(s) == 0x6B ) {
s++;
uint32_t *p = (uint32_t*)s;
uint32_t l = *p;
s+=4;
o = PyBytes_FromStringAndSize( s, l );
s += l;
}
else if ( *(s) == 0x61 ) { s += 1; Py_INCREF(Py_True); o = Py_True; }
else if ( *(s) == 0x62 ) { s += 1; Py_INCREF(Py_False); o = Py_False; }
else if ( *(s) == 0x63 ) {
Expand Down
1 change: 0 additions & 1 deletion tst.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

import traceback, mrjson
from mrhttp import app
import mrpacker

@app.route('/',_type='text')
def index(r):
Expand Down