Skip to content

Instantly share code, notes, and snippets.

@ti-kamlesh
ti-kamlesh / crc32.c
Last active August 25, 2023 15:33
crc splice based
#define _GNU_SOURCE /* See feature_test_macros(7) */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <errno.h>
#include <stdarg.h>
#include <limits.h>
@ti-kamlesh
ti-kamlesh / crc64.c
Created August 25, 2023 15:34
crc64.c
#define _GNU_SOURCE /* See feature_test_macros(7) */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <errno.h>
#include <stdarg.h>
#include <limits.h>
@ti-kamlesh
ti-kamlesh / mmap_crc32.c
Created August 30, 2023 11:09
crc32 with mmap from userspace
#define _GNU_SOURCE /* See feature_test_macros(7) */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <errno.h>
#include <stdarg.h>
#include <limits.h>
+-------------------+-----------------------------+-----------------------+------------------------+------------------------+
| | | | | |
| File size | 120mb(ideal size for us) | 20mb | 15mb | 5mb |
+===================+=============================+=======================+========================+========================+
| | | | | |
| CRC32 (Case 1) | Driver time 0.155s | Driver time 0.0325s | Driver time 0.019s | Driver time 0.0062s |
| | real time 0.18s | real time 0.06s | real time 0.04s | real time 0.03s |
| | overhead 0.025s | overhead 0.025s | overhead 0.021s | overhead ~0.023s |
+---------------