🔵 برخی از کاربرد های map
🔴Storing Configuration Data:
Maps are often used to store configuration settings where keys represent configuration names and values hold corresponding settings. This allows for easy retrieval and modification of configuration parameters.
🔴Counting Occurrences:
Maps are useful for counting occurrences of elements in a collection. For example, you can use a map to count the frequency of words in a text or the occurrence of specific items in a dataset.
🔴Implementing Caches:
Maps can be employed to create in-memory caches for quick access to frequently accessed data. By using keys as identifiers and values as cached data, maps facilitate fast retrieval without the need for repeated expensive computations.
🔴Grouping Data:
Maps enable grouping related data together based on a common key. This is beneficial when organizing information that shares a common attribute or category.
🔴Error Handling:
Maps can be utilized to store error codes or messages associated with specific error scenarios, allowing for efficient error handling and reporting within an application.
🔴Implementing Lookup Tables:
Maps serve as efficient lookup tables where keys correspond to specific values or actions. This is commonly used in scenarios where quick access to associated data based on a key is required.
🔴Implementing State Machines:
Maps can represent states and transitions in state machines by mapping states to possible transitions or actions, providing a structured way to manage state-based logic.
🔴Data Validation:
Maps can be used for data validation by storing validation rules or constraints associated with different data fields, enabling easy validation checks during input processing.
➖➖➖➖➖➖➖➖
🕊 @gopher_academy | @GolangEngineers
🔴Storing Configuration Data:
Maps are often used to store configuration settings where keys represent configuration names and values hold corresponding settings. This allows for easy retrieval and modification of configuration parameters.
🔴Counting Occurrences:
Maps are useful for counting occurrences of elements in a collection. For example, you can use a map to count the frequency of words in a text or the occurrence of specific items in a dataset.
🔴Implementing Caches:
Maps can be employed to create in-memory caches for quick access to frequently accessed data. By using keys as identifiers and values as cached data, maps facilitate fast retrieval without the need for repeated expensive computations.
🔴Grouping Data:
Maps enable grouping related data together based on a common key. This is beneficial when organizing information that shares a common attribute or category.
🔴Error Handling:
Maps can be utilized to store error codes or messages associated with specific error scenarios, allowing for efficient error handling and reporting within an application.
🔴Implementing Lookup Tables:
Maps serve as efficient lookup tables where keys correspond to specific values or actions. This is commonly used in scenarios where quick access to associated data based on a key is required.
🔴Implementing State Machines:
Maps can represent states and transitions in state machines by mapping states to possible transitions or actions, providing a structured way to manage state-based logic.
🔴Data Validation:
Maps can be used for data validation by storing validation rules or constraints associated with different data fields, enabling easy validation checks during input processing.
➖➖➖➖➖➖➖➖
🕊 @gopher_academy | @GolangEngineers
👍10🍾3🔥1
🔵 برخی از کاربرد های slice
🔴 Storing Data: Slices are extensively used to store and manage data in various scenarios, such as storing configuration settings, tracking collections of problems, or working with data from databases like MongoDB
🔴Dynamic Data Structures: Slices provide a dynamic nature that allows them to expand or shrink as needed, making them ideal for scenarios where the size of the data collection is unknown or needs to change dynamically
🔴Iterating Over Data: Slices are commonly used for iterating over elements in a collection, enabling efficient traversal and manipulation of data stored in the slice
🔴Appending Elements: The append function in Go is frequently used with slices to add elements to the end of a slice, facilitating dynamic growth and modification of the data stored in the slice
🔴Passing Data: Slices are often passed by reference, allowing modifications made to a slice within a function to reflect in the original slice outside the function, making them efficient for managing data across different parts of a program
🔴Grouping Similar Data: Slices are used to group similar data together, providing a convenient way to work with related elements in a collection
🔴Filtering Data: Slices can be used to filter data based on specific criteria, creating new slices that hold only the elements that satisfy certain conditions, enhancing data processing capabilities
🔴Efficient Memory Management: Slices offer efficient memory management by dynamically adjusting their size and capacity as elements are added or removed, optimizing memory usage in Go programs
➖➖➖➖➖➖➖➖
🕊 @gopher_academy | @GolangEngineers
🔴 Storing Data: Slices are extensively used to store and manage data in various scenarios, such as storing configuration settings, tracking collections of problems, or working with data from databases like MongoDB
🔴Dynamic Data Structures: Slices provide a dynamic nature that allows them to expand or shrink as needed, making them ideal for scenarios where the size of the data collection is unknown or needs to change dynamically
🔴Iterating Over Data: Slices are commonly used for iterating over elements in a collection, enabling efficient traversal and manipulation of data stored in the slice
🔴Appending Elements: The append function in Go is frequently used with slices to add elements to the end of a slice, facilitating dynamic growth and modification of the data stored in the slice
🔴Passing Data: Slices are often passed by reference, allowing modifications made to a slice within a function to reflect in the original slice outside the function, making them efficient for managing data across different parts of a program
🔴Grouping Similar Data: Slices are used to group similar data together, providing a convenient way to work with related elements in a collection
🔴Filtering Data: Slices can be used to filter data based on specific criteria, creating new slices that hold only the elements that satisfy certain conditions, enhancing data processing capabilities
🔴Efficient Memory Management: Slices offer efficient memory management by dynamically adjusting their size and capacity as elements are added or removed, optimizing memory usage in Go programs
➖➖➖➖➖➖➖➖
🕊 @gopher_academy | @GolangEngineers
👍6🍾5🔥1
🔵 یه سری نکات در مورد GC ها
🔴 Mark-Sweep Technique: Go's GC uses the mark-sweep technique, where it marks values it encounters as live to keep track of its progress during garbage collection
🔴GOGC Configuration: The GOGC environment variable or the SetGCPercent API in the runtime/debug package can be used to configure the garbage collection behavior in Go. GOGC determines the trade-off between GC CPU and memory, setting the target heap size after each GC cycle
🔴GC Performance: The GC in Go is known for its speed, with garbage collection times measuring less than 1ms on an 18GB heap in Go 1.8. Subsequent releases have further improved GC performance, making it efficient for most workloads
🔴Latency vs. Throughput: The Go GC is tuned for latency, making it suitable for scenarios where GC pauses are tolerable. However, for use cases where throughput is crucial, such as offline CPU-bound batch processing, other options may be more optimal
🔴Dynamic Data Structures: When dynamic data structures are needed in Go, developers can choose between hand-rolled linked structures, slices, maps, or compose them to meet the requirements of the solution
➖➖➖➖➖➖➖➖
🕊 @gopher_academy | @GolangEngineers
🔴 Mark-Sweep Technique: Go's GC uses the mark-sweep technique, where it marks values it encounters as live to keep track of its progress during garbage collection
🔴GOGC Configuration: The GOGC environment variable or the SetGCPercent API in the runtime/debug package can be used to configure the garbage collection behavior in Go. GOGC determines the trade-off between GC CPU and memory, setting the target heap size after each GC cycle
🔴GC Performance: The GC in Go is known for its speed, with garbage collection times measuring less than 1ms on an 18GB heap in Go 1.8. Subsequent releases have further improved GC performance, making it efficient for most workloads
🔴Latency vs. Throughput: The Go GC is tuned for latency, making it suitable for scenarios where GC pauses are tolerable. However, for use cases where throughput is crucial, such as offline CPU-bound batch processing, other options may be more optimal
🔴Dynamic Data Structures: When dynamic data structures are needed in Go, developers can choose between hand-rolled linked structures, slices, maps, or compose them to meet the requirements of the solution
➖➖➖➖➖➖➖➖
🕊 @gopher_academy | @GolangEngineers
🍾4👍2🔥2
Forwarded from Gopher Academy (𓄂👑𓆃)
اگر پرمیوم هستید در تلگرام می توانید با زدن Boost از کانال گوفر آکادمی و گروه مهندسین گولنگ حمایت کنید.
https://t.me/gopher_academy?boost
➖➖➖➖➖➖➖➖
🕊 @gopher_academy
https://t.me/gopher_academy?boost
➖➖➖➖➖➖➖➖
🕊 @gopher_academy
🍾7👍2🔥1🕊1
Since Go 1.23, the idiomatic use of time.Timer will be changed to be much more clean.
➖➖➖➖➖➖➖➖
🕊 @gopher_academy | @GolangEngineers
➖➖➖➖➖➖➖➖
🕊 @gopher_academy | @GolangEngineers
👍10
🔵 هرانچه که باید در مورد Process vs Thread بدونید
🔴Definition:
🟢Process: A process is an active program under execution, containing its own memory space and resources.
🟢Thread: A thread is a lightweight process that can be managed independently by a scheduler, sharing memory and resources with other threads within the same process.
🔴Context Switching:
🟢Process: Processes require more time for context switching due to their heavier nature.
🟢Thread: Threads require less time for context switching as they are lighter than processes.
🔴Memory Sharing:
🟢Process: Processes are independent and do not share memory with other processes.
🟢Thread: Threads may share memory with their peer threads within the same process.
🔴Communication:
🟢Process: Communication between processes takes more time compared to communication between threads.
🟢Thread: Communication between threads is faster than between processes.
🔴Blocked:
🟢Process: If a process gets blocked, other processes can continue execution independently.
🟢Thread: If a user-level thread gets blocked, all peer threads within the same process are also blocked.
🔴Resource Consumption:
🟢Process: Processes generally require more resources than threads.
🟢Thread: Threads need fewer resources compared to processes.
🔴Dependency:
🟢Process: Individual processes are independent of each other.
🟢Thread: Threads are parts of a process and are interdependent.
🔴Data and Code Sharing:
🟢Process: Processes have independent data and code segments.
🟢Thread: Threads share data and code segments with their peer threads.
🔴Creation and Termination:
🟢Process: Processes take more time for creation and termination.
🟢Thread: Threads require less time for creation and termination.
➖➖➖➖➖➖➖➖
🕊 @gopher_academy | @GolangEngineers
🔴Definition:
🟢Process: A process is an active program under execution, containing its own memory space and resources.
🟢Thread: A thread is a lightweight process that can be managed independently by a scheduler, sharing memory and resources with other threads within the same process.
🔴Context Switching:
🟢Process: Processes require more time for context switching due to their heavier nature.
🟢Thread: Threads require less time for context switching as they are lighter than processes.
🔴Memory Sharing:
🟢Process: Processes are independent and do not share memory with other processes.
🟢Thread: Threads may share memory with their peer threads within the same process.
🔴Communication:
🟢Process: Communication between processes takes more time compared to communication between threads.
🟢Thread: Communication between threads is faster than between processes.
🔴Blocked:
🟢Process: If a process gets blocked, other processes can continue execution independently.
🟢Thread: If a user-level thread gets blocked, all peer threads within the same process are also blocked.
🔴Resource Consumption:
🟢Process: Processes generally require more resources than threads.
🟢Thread: Threads need fewer resources compared to processes.
🔴Dependency:
🟢Process: Individual processes are independent of each other.
🟢Thread: Threads are parts of a process and are interdependent.
🔴Data and Code Sharing:
🟢Process: Processes have independent data and code segments.
🟢Thread: Threads share data and code segments with their peer threads.
🔴Creation and Termination:
🟢Process: Processes take more time for creation and termination.
🟢Thread: Threads require less time for creation and termination.
➖➖➖➖➖➖➖➖
🕊 @gopher_academy | @GolangEngineers
🍾7
🔵A Crash Course in IPv4 Addressing
🔴https://blog.bytebytego.com/p/a-crash-course-in-ipv4-addressing
➖➖➖➖➖➖➖➖
🕊 @gopher_academy | @GolangEngineers
🔴https://blog.bytebytego.com/p/a-crash-course-in-ipv4-addressing
➖➖➖➖➖➖➖➖
🕊 @gopher_academy | @GolangEngineers
👍3❤1🍾1
🎯یه مقاله خوب در مورد مدل M-P-G گولنگ که توسط سینا نوشته شده
🎯 مقاله ای هست با کلی نکته برای درک بهتر اینکه چطور الگوریتم زمانبند رانتایم کار می کند
👇به یه سری سوالت جواب میده این مقاله سوالاتی همچون
🔻مفهوم ترد یا نخ یا thread چیه؟
🔻اما thread با پروسه چه فرقی میکنه؟
🔻اصطلاح execution contextچیه؟
🔻سی پی یو dispatch کار چیه؟
🔻زمان بند چیه؟
🔻تفاوت نخ های هسته و نخ های سطح کاربر یا همون goroutine ها توی go چیه؟
🔻حالت های گوروتین ها از نظر اجرا
🔻دلایل مختلف بلاک شدن یک گوروتین
🔻استراتژی hands off
🔻قتی syscall زده میشه نخ یا M جدید از کجا پیداش میشه؟
🔻چه زمانی thread ها در حالت spinning هستن؟
🔻اصطلاح hand off و spinning و netpoller چیه؟
👑 https://blog.snix.ir/posts/golang-scheduler-MPG-model
➖➖➖➖➖➖➖
🕊 @gopher_academy | @GolangEngineers
🎯 مقاله ای هست با کلی نکته برای درک بهتر اینکه چطور الگوریتم زمانبند رانتایم کار می کند
👇به یه سری سوالت جواب میده این مقاله سوالاتی همچون
🔻مفهوم ترد یا نخ یا thread چیه؟
🔻اما thread با پروسه چه فرقی میکنه؟
🔻اصطلاح execution contextچیه؟
🔻سی پی یو dispatch کار چیه؟
🔻زمان بند چیه؟
🔻تفاوت نخ های هسته و نخ های سطح کاربر یا همون goroutine ها توی go چیه؟
🔻حالت های گوروتین ها از نظر اجرا
🔻دلایل مختلف بلاک شدن یک گوروتین
🔻استراتژی hands off
🔻قتی syscall زده میشه نخ یا M جدید از کجا پیداش میشه؟
🔻چه زمانی thread ها در حالت spinning هستن؟
🔻اصطلاح hand off و spinning و netpoller چیه؟
👑 https://blog.snix.ir/posts/golang-scheduler-MPG-model
➖➖➖➖➖➖➖
🕊 @gopher_academy | @GolangEngineers
👍5🔥4🕊1🍾1
این سایت توضیح شغلی به AI اش میدید و ازتون با توجه به همون توضیحات مصاحبه میکنه.
#pythony
https://interviewsby.ai
➖➖➖➖➖➖➖
🕊 @gopher_academy | @GolangEngineers
#pythony
https://interviewsby.ai
➖➖➖➖➖➖➖
🕊 @gopher_academy | @GolangEngineers
❤7👍4🕊1
🔵 A Crash Course in CI/CD
🔴 https://blog.bytebytego.com/p/a-crash-course-in-cicd
➖➖➖➖➖➖➖
🕊 @gopher_academy | @GolangEngineers
🔴 https://blog.bytebytego.com/p/a-crash-course-in-cicd
➖➖➖➖➖➖➖
🕊 @gopher_academy | @GolangEngineers
❤2🕊2👍1🍾1
🔵یه تجربه با گولنگ که کدشو برای پردازش هزاران خط متن ورودی بهینه کرده.
مخصوصا در مورد memory allocationها دید خوبی میده و جالبه اگه به پرفورمنس علاقه دارید بخونید:
🔴 https://benhoyt.com/writings/go-1brc/
#terminal_stuff
➖➖➖➖➖➖➖
🕊 @gopher_academy | @GolangEngineers
مخصوصا در مورد memory allocationها دید خوبی میده و جالبه اگه به پرفورمنس علاقه دارید بخونید:
🔴 https://benhoyt.com/writings/go-1brc/
#terminal_stuff
➖➖➖➖➖➖➖
🕊 @gopher_academy | @GolangEngineers
👍3🍾2🔥1
🐧 نشست ۱۴ ام جامعه لینوکسی شیراز
🟢 موضوع ارائه : امنیت در کانتینرها
🐦 ارائه دهنده : سعید بستان دوست
🐧 رزومه ارائه دهنده : برنامه نویس و طرفدار دنیای اوپن سورس
🗓تاریخ : سهشنبه ۲۱ ام فروردین ماه
⏰ساعت : ۱۷:۰۰ الی ۱۹:۰۰
📍مکان: بلوار مدرس، بلوار آزادگان، کارخانه نوآوری شیراز طبقه دوم انتهای سالن اتاق آموزشی
حامی برگزاری : کارخانه نوآوری شیراز 🍀
حضور برای عموم رایگان میباشد
⭕️ با توجه به محدودیت های ظرفیت برای شرکت کنندگان و مدل رایگان بودن این رویداد، جهت حفظ ارزش آفرینی عدم حضور شما بعد از ثبتنام به منزله اضافه شدن نام شما به لیست شرکت کنندگان بد قول جامعه های فعال ما خواهد شد و در صورت تکرار مجدد، از حضور در رویدادهای رایگان جامعه لینوکسی شیراز به صورت رایگان محدود خواهید شد.
جهت ثبت نام روی لینک زیر کلیک کنید👇🏻
https://shirazlinuxcommunity.ir/event-14
📍Location
OSM : OpenStreetMap
GoogleMap : GoogleMap
➖➖➖➖➖➖➖
🕊 @gopher_academy | @GolangEngineers
🟢 موضوع ارائه : امنیت در کانتینرها
🐦 ارائه دهنده : سعید بستان دوست
🐧 رزومه ارائه دهنده : برنامه نویس و طرفدار دنیای اوپن سورس
🗓تاریخ : سهشنبه ۲۱ ام فروردین ماه
⏰ساعت : ۱۷:۰۰ الی ۱۹:۰۰
📍مکان: بلوار مدرس، بلوار آزادگان، کارخانه نوآوری شیراز طبقه دوم انتهای سالن اتاق آموزشی
حامی برگزاری : کارخانه نوآوری شیراز 🍀
حضور برای عموم رایگان میباشد
⭕️ با توجه به محدودیت های ظرفیت برای شرکت کنندگان و مدل رایگان بودن این رویداد، جهت حفظ ارزش آفرینی عدم حضور شما بعد از ثبتنام به منزله اضافه شدن نام شما به لیست شرکت کنندگان بد قول جامعه های فعال ما خواهد شد و در صورت تکرار مجدد، از حضور در رویدادهای رایگان جامعه لینوکسی شیراز به صورت رایگان محدود خواهید شد.
جهت ثبت نام روی لینک زیر کلیک کنید👇🏻
https://shirazlinuxcommunity.ir/event-14
📍Location
OSM : OpenStreetMap
GoogleMap : GoogleMap
➖➖➖➖➖➖➖
🕊 @gopher_academy | @GolangEngineers
🍾5🎉3👍1
Golang 1.22 Redefines the For Loop for Easier Concurrency
https://thenewstack.io/golang-1-22-redefines-the-for-loop-for-easier-concurrency/
➖➖➖➖➖➖➖➖
🕊 @gopher_academy | @GolangEngineers
https://thenewstack.io/golang-1-22-redefines-the-for-loop-for-easier-concurrency/
➖➖➖➖➖➖➖➖
🕊 @gopher_academy | @GolangEngineers
👍4🍾2