Skip to content

feat(clipper): Implement concurrent file reading and refactor project structure#34

Merged
supitsdu merged 5 commits intomainfrom
feature/concurrency
Jun 30, 2024
Merged

feat(clipper): Implement concurrent file reading and refactor project structure#34
supitsdu merged 5 commits intomainfrom
feature/concurrency

Conversation

@supitsdu
Copy link
Copy Markdown
Owner

@supitsdu supitsdu commented Jun 30, 2024

This PR enhances Clipper by introducing concurrent file reading using goroutines and channels in the new cli/reader/reader.go package. It refactors cli/clipper/clipper.go to utilize these improvements, improving performance and maintainability. The test structure is also reorganized for clarity.

Changes

  • New cli/reader/reader.go Package:

    • Implements concurrent file reading with goroutines and channels.
    • Introduces ReadContentConcurrently function for efficient file handling.
  • Refactored cli/clipper/clipper.go:

    • Updated to leverage cli/reader/reader.go for file reading operations.
    • Enhances code clarity and separation of concerns.
  • Enhanced Test Structure:

    • Introduces tests/tests.go for shared testing utilities.
    • Restructures tests into tests/clipper/clipper_test.go and tests/reader/reader_test.go.

Tasks

  • Implement concurrent file reading with cli/reader/reader.go.
  • Refactor cli/clipper/clipper.go for improved readability and performance.
  • Organize tests into dedicated files for better maintainability and focus.
  • Benchmark performance improvements with concurrent file reading.
  • Document benchmark results and optimizations for future reference.

Next Steps

Upon merging, focus will shift to benchmarking the application to quantify performance gains from concurrent file reading. This will inform future optimizations and enhancements to Clipper's file handling capabilities.

Closes #23

supitsdu added 5 commits June 30, 2024 02:43
…tines and channels

Added new package `cli/reader/reader.go` to handle file and stdin content reading using goroutines and channels. Includes `ReadContentConcurrently` function to improve performance when handling multiple files.

Issue #23
…tent reading

Refactored `cli/clipper/clipper.go` to utilize functionalities from `cli/reader/reader.go` package. This change improves code readability and separates concerns for content reading operations.
…and constants

Introduced `tests/tests.go` to hold helper functions and constants used across test cases, improving organization and reusability of testing resources.
…/clipper/clipper.go` tests

Reorganized `tests/clipper/clipper_test.go` to focus exclusively on testing functionalities within `cli/clipper/clipper.go`, ensuring clear and specific test coverage.
…ader.go` tests

Introduced `tests/reader/reader_test.go` to contain tests exclusively targeting functionalities within `cli/reader/reader.go`. Enhances clarity and maintainability of test cases related to content reading operations.
@supitsdu supitsdu added enhancement New feature requests or enhancements. refactoring Issues or PRs to improving code structure, without changing its external behavior performance Issues or PRs focused on optimizing Go code performance. concurrency labels Jun 30, 2024
@supitsdu supitsdu self-assigned this Jun 30, 2024
@supitsdu supitsdu merged commit 7ddb223 into main Jun 30, 2024
@supitsdu supitsdu deleted the feature/concurrency branch June 30, 2024 07:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

concurrency enhancement New feature requests or enhancements. performance Issues or PRs focused on optimizing Go code performance. refactoring Issues or PRs to improving code structure, without changing its external behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Explore Concurrency (goroutines and channels) for Copying from Multiple Files

2 participants