backend
-
Go: 금칙어 검사 함수들 벤치마크 및 향상컴퓨터/Go language 2024. 5. 2. 00:28
금지어 리스트를 .txt 에 저장하고 서버 메모리에 로딩했다. (10kb)금지어를 가장 빠르게 체크하는 방법은 무엇일까 궁금해서 벤치마크를 돌려보았다.기준: 10KB input string + 500개 금지어 리스트 1. 정규 표현식 사용성능: 14,260K ns/op메모리 사용: 4321B/op할당 횟수: 24 allocs/op아래처럼 첫 로딩에 regex로 패턴을 모두 컴파일 하고, 인풋 string을 확인했다.생각보다 대용량일 수록 굉장히 느리다.func CompileBadWordsPattern() error { var pattern strings.Builder pattern.WriteString(`(`) for i, word := range badWordsList { if word == "" {..
-
Wails: Go언어를 이용해 크로스 플랫폼 앱 만들기컴퓨터/Go language 2022. 6. 26. 12:38
Wails The Wails Project | Wails Build beautiful cross-platform applications using Go wails.io 소개 Wails는 Go언어를 이용하여 크로스 플랫폼 앱을 만들게 도와준다. (MacOS/Windows/Linux) 프런트엔드는 Svelete, React 등을 사용해서 할 수 있고, wails는 Go언어로 빌드나 함수 -> JS를 도와준다. 설치는 쉬우니 공식 사이트를 확인하면 된다. @공식 문서 만들면서 배운 것 Svelte랑 프런트엔드 쪽은 많이 안 해봐서 쉬운 것부터 시작했다. 대학교 공지 홈페이지에서 각 카테고리별로 Go언어로 파싱하고 앱에 뿌리는 것이다. Go언어 Struct -> TypeScript 우선 Go언어로 짠 struc..
-
Rust 백엔드: REST API (Rocket + MySQL)컴퓨터/Rust 2021. 7. 14. 14:11
Rocket Rust 언어용 웹 프레임워크 Rocket - Simple, Fast, Type-Safe Web Framework for Rust Forms? Check! Handling forms is simple and easy. rocket.rs Rust Rocket 기본 설정 프로젝트 시작 cargo new rustweb --bin cd rustweb 기본 src/main.rs #[macro_use] extern crate rocket; #[get("/")] fn index() -> &'static str { "Hello, world!" } #[launch] fn rocket() -> _ { rocket::build().mount("/", routes![index]) } cargo build carg..